IceDynamix / reliquary-archiver

tool to create a relic export from network packets of a certain turn-based anime game
MIT License
186 stars 18 forks source link

Saving archive_output.json in the wrong location #23

Closed WolfHeroEX closed 4 months ago

WolfHeroEX commented 4 months ago

For whatever reason, the program wasn't saving archive_output.json at all, throwing an application panicked error after the data was successfully gathered. So I was curious, and ran it as administrator instead of just letting the program send an admin request as it normally does. It said it worked, but I couldn't find the file. Turns out, it was saved in System32 of all places.

I tried running the program through Terminal, and it then saved the output file in my specific User folder. Another time when I opened it from Everything (a search program), it saved the output to the Everything program folder.

So I'm assuming it's saving not in Downloads where the program actually is, but instead (for some reason) in whatever folder the wrapper is in. Any idea why it'd be doing this for me?

FaeronGaming commented 4 months ago

What you experienced with executing through terminal and Everything is as expected. Unless you provide an [OUTPUT] argument rust will just write archive_output.json to the current working directory.

What isn't expected is writing to System32. Ignoring the necessity of elevated permissions, running the exe from downloads should write to downloads. That's the behavior I see when running the exe from my own downloads folder, and that same current working directory behavior is what I see when running the repo locally with cargo run. The only reason it would write to that location is if your Windows itself is setting the CWD to System32, but I cannot think of any reason why.

FichteFoll commented 4 months ago

If I remember correctly, cmd.exe starts in the System32 folder (and maybe powershell does as well). How exactly did you execute it, @WolfHeroEX?

WolfHeroEX commented 4 months ago

If I remember correctly, cmd.exe starts in the System32 folder (and maybe powershell does as well). How exactly did you execute it, @WolfHeroEX?

The time it wrote to System32, I was running it directly from the downloads folder. ... It's odd. I just tried it today and it wrote correctly to Downloads. Must've been a problem with my pc and not the program.

FaeronGaming commented 4 months ago

If I remember correctly, cmd.exe starts in the System32 folder (and maybe powershell does as well). How exactly did you execute it, @WolfHeroEX?

I can't confirm on Win8 and earlier, but at least with 10 and 11 this is not the case. Both cmd and powershell open the home directory.

IceDynamix commented 4 months ago

since this issue lies outside the scope of rqa, i think the best way to address this is to simply print the full path of the output file to logs, so even if it happens to output to the wrong location there won't be any confusion about where the file ended up

FaeronGaming commented 4 months ago

More info now that I've joined Fribbels's discord. The system32 issue stems from windows search

https://discord.com/channels/800607517074784256/1233840001905856572/1243402309984059432

image

Could be worth poking at a fallback to the exe's location if the path contains System32, but I think this problem is niche enough to sleep on.

IceDynamix commented 4 months ago

closed with #26