Skip to content

Commit

Permalink
fix problems when relative paths are added to NoteList;
Browse files Browse the repository at this point in the history
update version number;
  • Loading branch information
changbowen committed Nov 11, 2019
1 parent 27ca6f3 commit a26226f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void RunCheck(object sender1, StartupEventArgs e1)
Res = Current.Resources;

//load notes
foreach (var path in Setting.NoteList) {
foreach (var path in Setting.NoteList.Cast<string>().ToArray()) {
Helpers.OpenNote(path)?.Show();
}

Expand Down
4 changes: 3 additions & 1 deletion MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,10 @@ private void Win_Main_Loaded(object sender, RoutedEventArgs e)
source.AddHook(WndProc);

//update stuff
if (!Setting.NoteList.Contains(CurrentSetting.Doc_Location))
if (!Setting.NoteList.Contains(CurrentSetting.Doc_Location)) {
Setting.NoteList.Add(CurrentSetting.Doc_Location);
Setting.Save();
}
App.MainWindows.Add(this);
}

Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.1.0")]
[assembly: AssemblyFileVersion("1.5.1.0")]
[assembly: AssemblyVersion("1.5.2.0")]
[assembly: AssemblyFileVersion("1.5.2.0")]
3 changes: 3 additions & 0 deletions Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ internal string Doc_Location
set {
if (string.IsNullOrWhiteSpace(Path.GetFileName(value))) return;
if (doc_location == value) return;
//convert relative path to absolute path and check again
value = Path.GetFullPath(value);
if (doc_location == value) return;
if (MainWin != null && MainWin.IsLoaded) {
if (File.Exists(doc_location) && !File.Exists(value) &&
File.Exists(doc_location + ".txt") && !File.Exists(value + ".txt")) {
Expand Down
Binary file modified bin/Release/DesktopNote.exe
Binary file not shown.

0 comments on commit a26226f

Please sign in to comment.