From de489e8b2c6833a173de93db839ecb3eeac82799 Mon Sep 17 00:00:00 2001 From: azakhi Date: Fri, 31 Aug 2018 16:54:24 +0300 Subject: [PATCH] Fix folder bug --- .../ThemeEditor/StringThemeComponent.cs | 27 ++++++++++--------- .../ViewModels/ItemFilterScriptViewModel.cs | 7 +++-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Filtration.ObjectModel/ThemeEditor/StringThemeComponent.cs b/Filtration.ObjectModel/ThemeEditor/StringThemeComponent.cs index 1667226..1975dc5 100644 --- a/Filtration.ObjectModel/ThemeEditor/StringThemeComponent.cs +++ b/Filtration.ObjectModel/ThemeEditor/StringThemeComponent.cs @@ -30,19 +30,22 @@ namespace Filtration.ObjectModel.ThemeEditor _customSoundsAvailable = new ObservableCollection(); var poeFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + @"\My Games\Path of Exile\"; - var poeFolderFiles = System.IO.Directory.GetFiles(poeFolderPath).Where( - s => s.EndsWith(".mp3") - || s.EndsWith(".wav") - || s.EndsWith(".wma") - || s.EndsWith(".3gp") - || s.EndsWith(".aag") - || s.EndsWith(".m4a") - || s.EndsWith(".ogg") - ).OrderBy(f => f); - - foreach (var file in poeFolderFiles) + if(System.IO.Directory.Exists(poeFolderPath)) { - _customSoundsAvailable.Add(file.Replace(poeFolderPath, "")); + var poeFolderFiles = System.IO.Directory.GetFiles(poeFolderPath).Where( + s => s.EndsWith(".mp3") + || s.EndsWith(".wav") + || s.EndsWith(".wma") + || s.EndsWith(".3gp") + || s.EndsWith(".aag") + || s.EndsWith(".m4a") + || s.EndsWith(".ogg") + ).OrderBy(f => f); + + foreach (var file in poeFolderFiles) + { + _customSoundsAvailable.Add(file.Replace(poeFolderPath, "")); + } } } diff --git a/Filtration/ViewModels/ItemFilterScriptViewModel.cs b/Filtration/ViewModels/ItemFilterScriptViewModel.cs index 2548467..a5b3c15 100644 --- a/Filtration/ViewModels/ItemFilterScriptViewModel.cs +++ b/Filtration/ViewModels/ItemFilterScriptViewModel.cs @@ -167,9 +167,8 @@ namespace Filtration.ViewModels _viewItemFilterBlockViewModels = new ObservableCollection(); _customSoundsAvailable = new ObservableCollection(); - - var poeFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + @"\My Games\Path of Exile\"; - var poeFolderFiles = Directory.GetFiles(poeFolderPath).Where( + + var poeFolderFiles = Directory.GetFiles(persistenceService.DefaultPathOfExileDirectory() + "\\").Where( s => s.EndsWith(".mp3") || s.EndsWith(".wav") || s.EndsWith(".wma") @@ -181,7 +180,7 @@ namespace Filtration.ViewModels foreach(var file in poeFolderFiles) { - _customSoundsAvailable.Add(file.Replace(poeFolderPath, "")); + _customSoundsAvailable.Add(file.Replace(persistenceService.DefaultPathOfExileDirectory() + "\\", "")); } }