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

Application is creating a directory named "~" for storing data #381

Closed
Kreeblah opened this issue Sep 12, 2024 · 6 comments
Closed

Application is creating a directory named "~" for storing data #381

Kreeblah opened this issue Sep 12, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@Kreeblah
Copy link

Describe the bug
This is with version 2.7.0 on macOS 14.6.1 on an M1 Max Macbook Pro.

I noticed after filing #380 that I had a directory named "~" alongside the SteamPrefill binary. This seemed odd, so I looked in there and found a directory structure that looks like Library/Caches/SteamPrefill/v1/. So, apparently that's not being appropriately replaced with my home directory.

Additional Details
If I delete this directory, it is recreated the next time I attempt to run SteamPrefill.

Screenshots
If applicable, add screenshots to help explain your problem.

Logs
Please attach the app.log found in the application's directory to this issue.

@Kreeblah Kreeblah added the bug Something isn't working label Sep 12, 2024
@tpill90
Copy link
Owner

tpill90 commented Dec 14, 2024

I don't have a Mac to test this with, but could you please let me know what the value of the environment variable "$PATH" is on your machine? I'm wondering if that should be what I'm looking at instead.

@Kreeblah
Copy link
Author

I suspect you probably want to look at $HOME. This is what I have for that:

fsh " echo $HOME
/Users/myuser

If you're still curious about $PATH, though, here's what mine looks like:

fsh " echo $PATH
/opt/homebrew/bin /opt/homebrew/sbin /opt/local/sbin /opt/local/bin /Users/myuser/.cargo/bin /Applications/ShellHistory.app/Contents/Helpers /Users/myuser/.local/bin /Users/myuser/.fig/bin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin /opt/X11/bin /Applications/Pololu USB AVR Programmer v2.app/Contents/MacOS /Library/Apple/usr/bin /Applications/Little Snitch.app/Contents/Components /Applications/Server.app/Contents/ServerRoot/usr/bin /Applications/Server.app/Contents/ServerRoot/usr/sbin /Applications/VMware Fusion.app/Contents/Public /usr/local/share/dotnet ~/.dotnet/tools /Library/TeX/texbin /Applications/Wireshark.app/Contents/MacOS

@tpill90
Copy link
Owner

tpill90 commented Dec 15, 2024

You're right, I was looking for $HOME. Not sure what my brain was thinking.

I'm not familiar with where MacOS keeps temporary files, but would /Users/myuser/Library/Caches be the right place to be sticking SteamPrefill's temp data?

@Kreeblah
Copy link
Author

I guess that depends. If we're talking temporary for the lifetime of the process, then $TMPDIR is probably going to be what you want. Each process automatically gets a randomly-named directory created for it in /var/folders/nk/ that's available in that environment variable, and it's also automatically cleaned up when the process exits. For example, the value of it for a terminal session I have open right now looks like this:

$ echo $TMPDIR
/var/folders/nk/s955071d24d2lx0v7_f0jd140000gn/T/

Anything I were to put in there would be automatically removed when my terminal session ends. Each process that I run in the terminal gets its own directory as well.

If it needs to persist through runs, then, yeah, something like $HOME/Library/Caches/steam-lancache-prefill could be a good place for them. That's typically used for files that are persisted for performance reasons, but wouldn't negatively impact things (other than whatever time it takes to regenerate them) if they're removed (so . . . caches).

If it's related to user-generated data, then $HOME/Library/Application Support/steam-lancache-prefill would be the place for that.

There's also a $HOME/Library/Preferences directory which is used for user preferences, but it's only supposed to be written to via system calls, and not by writing files directly. I see a lot of applications use $HOME/Library/Application Support instead when they aren't written to use the macOS native APIs.

https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html#//apple_ref/doc/uid/TP40010672-CH10-SW1 has more info about canonical directory locations, if you're curious.

@tpill90
Copy link
Owner

tpill90 commented Dec 20, 2024

Yeah this data will be persisted through runs, just saving manifests so that they don't need to be redownloaded again. Sounds like $HOME/Library/Caches is where I'll stick these manifests.

@tpill90 tpill90 added the pending release Fix has been merged, needs to be published label Dec 20, 2024
@tpill90 tpill90 removed the pending release Fix has been merged, needs to be published label Dec 20, 2024
@tpill90
Copy link
Owner

tpill90 commented Dec 20, 2024

Released in v3.1.0

@tpill90 tpill90 closed this as completed Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants