From 249377dff5341588679d6e2dd70fe9b8783ffce1 Mon Sep 17 00:00:00 2001 From: setchi Date: Fri, 9 Oct 2015 23:39:31 +0900 Subject: [PATCH] Fix a bug that setting of workspace directory is not reflected --- .../Presenter/MusicSelector/MusicSelectorPresenter.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Presenter/MusicSelector/MusicSelectorPresenter.cs b/Assets/Scripts/Presenter/MusicSelector/MusicSelectorPresenter.cs index b8f50a8..866bc76 100644 --- a/Assets/Scripts/Presenter/MusicSelector/MusicSelectorPresenter.cs +++ b/Assets/Scripts/Presenter/MusicSelector/MusicSelectorPresenter.cs @@ -32,10 +32,15 @@ void Start() { ResetEditor(); + Settings.WorkSpaceDirectoryPath + .Subscribe(workSpacePath => directoryPathInputField.text = workSpacePath + "/Musics/"); + directoryPathInputField.OnValueChangeAsObservable() .Subscribe(path => MusicSelector.DirectoryPath.Value = path); - MusicSelector.DirectoryPath.Subscribe(path => directoryPathInputField.text = path); - MusicSelector.DirectoryPath.Value = Settings.WorkSpaceDirectoryPath.Value + "/Musics/"; + + MusicSelector.DirectoryPath + .Subscribe(path => directoryPathInputField.text = path); + if (!Directory.Exists(MusicSelector.DirectoryPath.Value)) { @@ -92,7 +97,7 @@ IEnumerator LoadMusic(string fileName) void LoadEditData() { var fileName = Path.GetFileNameWithoutExtension(EditData.Name.Value) + ".json"; - var directoryPath = Application.persistentDataPath + "/Notes/"; + var directoryPath = MusicSelector.DirectoryPath.Value.Substring(0, MusicSelector.DirectoryPath.Value.Length - "/Musics/".Length) + "/Notes/"; var filePath = directoryPath + fileName; if (File.Exists(filePath))