Correct error in saving settings
This commit is contained in:
parent
b2992da370
commit
141a4c29bb
@ -52,15 +52,36 @@ namespace FileManager
|
||||
}
|
||||
}
|
||||
|
||||
public static implicit operator string(LongPath path) => path?.Path ?? null;
|
||||
public static implicit operator string(LongPath path) => path?.Path;
|
||||
|
||||
[JsonIgnore]
|
||||
public string ShortPathName
|
||||
{
|
||||
get
|
||||
{
|
||||
//Short Path names are useful for navigating to the file in windows explorer,
|
||||
//which will not recognize paths longer than MAX_PATH. Short path names are not
|
||||
//always enabled on every volume. So to check if a volume enables short path
|
||||
//names (aka 8dot3 names), run the following command from an elevated command
|
||||
//prompt:
|
||||
//
|
||||
// fsutil 8dot3name query c:
|
||||
//
|
||||
//It will say:
|
||||
//
|
||||
// "Based on the above settings, 8dot3 name creation is [enabled/disabled] on c:"
|
||||
//
|
||||
//To enable short names on all volumes on the system, run the following command
|
||||
//from an elevated command prompt:
|
||||
//
|
||||
// fsutil 8dot3name set c: 0
|
||||
//
|
||||
//Note that after enabling 8dot3 names on a volume, they will only be available
|
||||
//for newly-created entries in ther file system. Existing entries made while
|
||||
//8dot3 names were disabled will not be reachable by short paths.
|
||||
|
||||
if (Path is null) return null;
|
||||
GetShortPathName(Path, longPathBuffer, MAX_PATH);
|
||||
GetShortPathName(Path, longPathBuffer, MaxPathLength);
|
||||
return longPathBuffer.ToString();
|
||||
}
|
||||
}
|
||||
@ -84,9 +105,9 @@ namespace FileManager
|
||||
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern int GetShortPathName(string path, StringBuilder shortPath, int shortPathLength);
|
||||
private static extern int GetShortPathName([MarshalAs(UnmanagedType.LPWStr)] string path, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder shortPath, int shortPathLength);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern int GetLongPathName(string lpszShortPath, StringBuilder lpszLongPath, int cchBuffer);
|
||||
private static extern int GetLongPathName([MarshalAs(UnmanagedType.LPWStr)] string lpszShortPath, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpszLongPath, int cchBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,12 +52,6 @@ namespace LibationWinForms.Dialogs
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Directory.Exists(newBooks) && booksSelectControl.SelectedDirectoryIsCustom)
|
||||
{
|
||||
validationError($"Not saving change to Books location. This folder does not exist:\r\n{newBooks}", "Folder does not exist");
|
||||
return;
|
||||
}
|
||||
|
||||
// these 3 should do nothing. Configuration will only init these with a valid value. EditTemplateDialog ensures valid before returning
|
||||
if (!Templates.Folder.IsValid(folderTemplateTb.Text))
|
||||
{
|
||||
@ -76,8 +70,9 @@ namespace LibationWinForms.Dialogs
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (!Directory.Exists(newBooks) && booksSelectControl.SelectedDirectoryIsKnown)
|
||||
Directory.CreateDirectory(newBooks);
|
||||
LongPath lonNewBooks = newBooks;
|
||||
if (!Directory.Exists(lonNewBooks))
|
||||
Directory.CreateDirectory(lonNewBooks);
|
||||
|
||||
config.Books = newBooks;
|
||||
|
||||
|
||||
@ -37,18 +37,17 @@
|
||||
<ProjectReference Include="..\AppScaffolding\AppScaffolding.csproj" />
|
||||
<ProjectReference Include="..\FileLiberator\FileLiberator.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Form1.*.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Dialogs\SettingsDialog.*.cs">
|
||||
<DependentUpon>Dialogs\SettingsDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Dialogs\SettingsDialog.*.cs">
|
||||
<DependentUpon>SettingsDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user