Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If tag studio cannot find the library to save the library it cannot close the library #119

Closed
Loran425 opened this issue May 2, 2024 · 4 comments · Fixed by #136
Closed
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Loran425
Copy link
Collaborator

Loran425 commented May 2, 2024

Expected Behavior

If TagStudio cannot find the save directory for the library it should prompt the user to close the library or save in a new location

Current Behavior

Saving/Closing errors and the library remains open

Possible Solution

During save or close library, check that the save location is valid, if not, prompt the user to close the library or select a new location to save the library (should be the root of wherever the library folder moved)

Steps to Reproduce (Edit: no need to close/reopen TagStudio)

  1. Open a library
  2. Delete or rename the library folder from the file manager
  3. Attempt to use File > Save Library or File > Close Library
[LIBRARY] Saving Library to Disk...
Traceback (most recent call last):
  File "C:\Users\Loran425\PycharmProjects\TagStudio\tagstudio\src\qt\ts_qt.py", line 254, in <lambda>
    close_library_action.triggered.connect(lambda: self.close_library())
                                                   ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Loran425\PycharmProjects\TagStudio\tagstudio\src\qt\ts_qt.py", line 439, in close_library
    self.lib.save_library_to_disk()
  File "C:\Users\Loran425\PycharmProjects\TagStudio\tagstudio\src\core\library.py", line 870, in save_library_to_disk
    self.verify_ts_folders()
  File "C:\Users\Loran425\PycharmProjects\TagStudio\tagstudio\src\core\library.py", line 575, in verify_ts_folders
    os.mkdir(full_ts_path)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\Loran425\\Pictures\\Item Icons\\tradingicons\\Testing\\.TagStudio'
@Loran425 Loran425 added bug Something isn't working good first issue Good for newcomers labels May 2, 2024
@gabrieljreed
Copy link
Contributor

Similar to #118, I can't repro this on Mac

@Loran425
Copy link
Collaborator Author

Loran425 commented May 2, 2024

Modified Steps to reproduce.
Does this still not error on mac? @gabrieljreed

@gabrieljreed
Copy link
Contributor

gabrieljreed commented May 2, 2024

Yeah, I'm still not getting the error. Looking through the stack trace, it looks like it calls Library.verify_ts_folders() which will create the library path if it does not exist, which is where it's erroring out for you. For me, it successfully creates the new library and saves everything there.

I wonder if it's related to #120?

@SylviaSK
Copy link
Contributor

SylviaSK commented May 4, 2024

I am able to reproduce this on Linux (Mint). Even in cases with no spaces in filename, so unless that part is a Windows specific issue, I don't think its tied to #120.

Looking at os.mkdir() there might be a simple fix, changing it to os.makedirs(), that said it would only recreate the file structure it was expecting, so it also might not be what is actually desired.

That said, its worth noting that since swapping libraries performs a save first, if it fails, trying to swap libraries can't continue leaving you on the previous library. If that happens there is no error message for it in the core program, just in the logs. Might be worth its own issue?

SylviaSK added a commit to SylviaSK/TagStudio that referenced this issue May 4, 2024
CyanVoxel added a commit that referenced this issue May 5, 2024
Fix for #119, Prompt for new location user if library cannot be saved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants