Support custom temporary directory#166
Merged
AndreasSko merged 5 commits intomasterfrom Jun 1, 2025
Merged
Conversation
Users on iOS reported issues when importing backups: > Error while creating temporary directory: mkdir /var/folders/t_/0w12llq155s3bcljc16_hj_c0000gn/T/go-jwlm1513177742: operation not permitted It looks like Go might now always be able to determine the correct path for temporary directories. With this PR we now support customizing the tempDir. This will be used in the iOS app to create a tempDir via Swift and then providing it to go-jwlm.
The package has been deprecated.
The tests started to fail on Windows
with this error:
```
--- FAIL: TestCatalogNeedsUpdate (1.48s)
testing.go:1267: TempDir RemoveAll cleanup: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestCatalogNeedsUpdate734870388\001\catalog.db: The process cannot access the file because it is being used by another process.
--- FAIL: TestCatalogExists (1.47s)
testing.go:1267: TempDir RemoveAll cleanup: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestCatalogExists580267843\001\catalog.db: The process cannot access the file because it is being used by another process.
--- FAIL: Test_DownloadCatalog (1.58s)
testing.go:1267: TempDir RemoveAll cleanup: remove C:\Users\RUNNER~1\AppData\Local\Temp\Test_DownloadCatalog2314487335\001\catalog.db: The process cannot access the file because it is being used by another process.
```
The issue was that the files were not
closed, so the cleanup couldn't
delete the files.
AndreasSko
added a commit
to AndreasSko/library-merger
that referenced
this pull request
Jun 1, 2025
As explained in AndreasSko/go-library-merger#166 users reported issues with the temporary directory when importing backups. With this commit we explicitly set the temporary directory that is directly provided by the fileManager.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Users on iOS reported issues when importing backups:
It looks like Go might now always be able to determine the correct path for temporary directories.
With this PR we now support customizing the tempDir. This will be used in the iOS app to create a tempDir via Swift and then provide it to go-jwlm.
Other changes
Remove ioutil
The package has been deprecated.
Workaround for flaky test
Upgrade to Go 1.24
🐛 Files not closed in catalog unit tests
The tests started to fail on Windows with this error:
The issue was that the files were not closed, so the cleanup couldn't delete the files.