rmcrackan / Libation

Libation: Liberate your Library
GNU General Public License v3.0
2.76k stars 150 forks source link

Custom Books Location path ending in Books not possible #874

Closed sebinum closed 7 months ago

sebinum commented 7 months ago

Describe the bug Changing the Books Location to a custom path which targets a *\Books or *\books location is not possible.

To Reproduce Steps to reproduce the behavior:

  1. Go to Settings
  2. Click on Important Settings
  3. Under the Books Location select custom path
  4. Open file explorer by clicking ...
  5. Select path ending in \Books or \books
  6. The path is updated but \Books or \books section removed

Expected behavior It should be possible to define a custom path for the Books Location that targets a Books / books folder

Screenshots 01_fso_explorer_select_path 02_libtation_location_storage

Platform

Windows 10 (see logs), Linux (Ubuntu/Linux Mint Xfce)]

Log Files

2024-04-02 08:02:59.624 +02:00 [INF] (at AppScaffolding.LibationScaffolding.logStartupState(LibationFileManager.Configuration)) 
FF
 {}2024-04-02 08:02:59.665 +02:00 [INF] (at AppScaffolding.LibationScaffolding.logStartupState(LibationFileManager.Configuration)) Begin. {"AppName":"Libation","Version":"11.1.0.1","ReleaseIdentifier":"WindowsAvalonia","OS":"Windows","InteropFunctionsType":"WindowsConfigApp.WinInterop","Mode":"Release","LogLevel_Verbose_Enabled":false,"LogLevel_Debug_Enabled":false,"LogLevel_Information_Enabled":true,"LogLevel_Warning_Enabled":true,"LogLevel_Error_Enabled":true,"LogLevel_Fatal_Enabled":true,"BetaOptIn":false,"UseCoverAsFolderIcon":false,"LibationFiles":"C:\\Users\\sebas\\Libation","BooksDirectory":"\\\\?\\C:\\Users\\sebas\\Libation\\Books","InProgress":"C:\\Users\\sebas\\AppData\\Local\\Temp\\Libation","DownloadsInProgressDirectory":"\\\\?\\C:\\Users\\sebas\\AppData\\Local\\Temp\\Libation\\DownloadsInProgress","DownloadsInProgressFiles":0,"DecryptInProgressDirectory":"\\\\?\\C:\\Users\\sebas\\AppData\\Local\\Temp\\Libation\\DecryptInProgress","DecryptInProgressFiles":0}
 {}2024-04-02 08:02:59.811 +02:00 [ERR] (at LibationFileManager.InteropFactory.CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)) Unable to load module Microsoft.EntityFrameworkCore.resources, Version=7.0.12.0, Culture=en-GB, PublicKeyToken=##ommited
 {}2024-04-02 08:02:59.819 +02:00 [ERR] (at LibationFileManager.InteropFactory.CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)) Unable to load module Microsoft.EntityFrameworkCore.resources, Version=7.0.12.0, Culture=en, PublicKeyToken=##ommited
 {}2024-04-02 08:02:59.887 +02:00 [ERR] (at LibationFileManager.InteropFactory.CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)) Unable to load module Windows, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime
 {}2024-04-02 08:02:59.895 +02:00 [ERR] (at LibationFileManager.InteropFactory.CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)) Unable to load module Microsoft.Windows.SDK.NET, Culture=neutral, PublicKeyToken=null
 {}2024-04-02 08:03:00.217 +02:00 [ERR] (at LibationFileManager.InteropFactory.CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)) Unable to load module Microsoft.EntityFrameworkCore.Relational.resources, Version=7.0.12.0, Culture=en-GB, PublicKeyToken=##ommited
 {}2024-04-02 08:03:00.228 +02:00 [ERR] (at LibationFileManager.InteropFactory.CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)) Unable to load module Microsoft.EntityFrameworkCore.Relational.resources, Version=7.0.12.0, Culture=en, PublicKeyToken=##ommited
 {}2024-04-02 08:03:01.387 +02:00 [INF] (at ApplicationServices.LibraryCommands.GetCounts(System.Collections.Generic.IEnumerable`1[[DataLayer.LibraryBook, DataLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])) Book counts. ##ommited
 {}2024-04-02 08:03:01.401 +02:00 [INF] (at ApplicationServices.LibraryCommands.GetCounts(System.Collections.Generic.IEnumerable`1[[DataLayer.LibraryBook, DataLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])) PDF counts. ##ommited
 {}2024-04-02 08:03:01.826 +02:00 [INF] (at ApplicationServices.LibraryCommands.GetCounts(System.Collections.Generic.IEnumerable`1[[DataLayer.LibraryBook, DataLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])) Book counts. ##ommited
 {}2024-04-02 08:03:01.831 +02:00 [INF] (at ApplicationServices.LibraryCommands.GetCounts(System.Collections.Generic.IEnumerable`1[[DataLayer.LibraryBook, DataLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])) PDF counts. ##ommited
 {}2024-04-02 08:03:17.811 +02:00 [ERR] (at LibationFileManager.InteropFactory.CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)) Unable to load module System.Net.Sockets.resources, Version=7.0.0.0, Culture=en-GB, PublicKeyToken=##ommited
 {}2024-04-02 08:03:17.840 +02:00 [ERR] (at LibationFileManager.InteropFactory.CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)) Unable to load module System.Net.Sockets.resources, Version=7.0.0.0, Culture=en, PublicKeyToken=##ommited
 {}2024-04-02 08:13:12.063 +02:00 [INF] (at FileManager.PersistentDictionary.writeFile(System.String, Newtonsoft.Json.Linq.JToken)) Config changed. {"propertyName":"SettingsDialog","newValue":"{\r\n  \"X\": 1031,\r\n  \"Y\": 216,\r\n  \"Height\": 271,\r\n  \"Width\": 900,\r\n  \"IsMaximized\": false\r\n}"}
 {}2024-04-02 08:22:59.830 +02:00 [INF] (at FileManager.PersistentDictionary.writeFile(System.String, Newtonsoft.Json.Linq.JToken)) Config changed. {"propertyName":"Books","newValue":"\\\\?\\C:\\Users\\sebas\\Downloads"}
 {}2024-04-02 08:22:59.866 +02:00 [INF] (at FileManager.PersistentDictionary.writeFile(System.String, Newtonsoft.Json.Linq.JToken)) Config changed. {"propertyName":"SettingsDialog","newValue":"{\r\n  \"X\": 3920,\r\n  \"Y\": 458,\r\n  \"Height\": 499,\r\n  \"Width\": 937,\r\n  \"IsMaximized\": false\r\n}"}
 {}2024-04-02 08:23:01.690 +02:00 [INF] (at FileManager.PersistentDictionary.writeFile(System.String, Newtonsoft.Json.Linq.JToken)) Config changed. {"propertyName":"MainWindow","newValue":"{\r\n  \"X\": 3329,\r\n  \"Y\": 250,\r\n  \"Height\": 768,\r\n  \"Width\": 1968,\r\n  \"IsMaximized\": false\r\n}"}
rmcrackan commented 7 months ago

Weird. It works for me and your setting looks correct:

"BooksDirectory":"\\\\?\\C:\\Users\\sebas\\Libation\\Books"

If you right click a book and "Re-download this audiobook", where does the new one end up?

rmcrackan commented 7 months ago

Another thing to try: if you do this with a folder not named 'books', do you get the same error?

sebinum commented 7 months ago

Sorry, maybe wasn't fully clear. I started off with one of the default locations. Here Books as a target works for the options:

01_default_location

Here it automatically uses *\Books as the target path.

Once I select custom path literally every path is possible, as long as the target folder is NOT Books or books.

Example 1: Target C:\Users\sebas\Downloads\Books

Output from Settings.json

"Books": "\\\\?\\C:\\Users\\sebas\\Downloads",

Example 2: Target C:\Users\sebas\Downloads\Books\Random

Output from Settings.json

"Books": "\\\\?\\C:\\Users\\sebas\\Downloads\\Books\\Random",

To me it seems, that for the custom path it doesn't allow for the target path to end in Books, maybe because it is somehow reserved for the pre-selectable options from the default selection mentioned above?

rmcrackan commented 7 months ago

Once I select custom path literally every path is possible, as long as the target folder is NOT Books or books.

Wacky. This works just fine for me.

Screenshot 2024-04-02 15 45 29

sebinum commented 7 months ago

Mhh weird... any idea what could prevent it? I just tried to manually overwrite it in Settings.json, but it will just dump it in the Downloads folder (one hierarchy above).

Edit: I re-checked the logs on Windows 10 and Linux Mint XFCE (VM), I can see the following 2 errrors popping up irrespective of OS:

 {}2024-04-02 23:55:56.488 +02:00 [ERR] (at LibationFileManager.InteropFactory.CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)) Unable to load module Windows, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime
 {}2024-04-02 23:55:56.495 +02:00 [ERR] (at LibationFileManager.InteropFactory.CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)) Unable to load module Microsoft.Windows.SDK.NET, Culture=neutral, PublicKeyToken=null

Peculiar.

rmcrackan commented 7 months ago

Thank you for your patience. Finally found it. It was a Chardonnay-only bug which is why I didn't see it since I use Classic. I created a pre-release with your fix: v11.3.7