![ServerSync](https://media.forgecdn.net/avatars/thumbnails/254/696/256/256/637199290945083080.png)
[Linux] Files download to home folder, regardless of jar-file's location (add fallback options for SS location)
oitsjustjose opened this issue ยท 9 comments
Serversync Version:
Tested with 2.6.12 and 2.6.14
Minecraft Version:
1.10.2
Issue:
When running ServerSync on my Linux Mint partition (Linux Mint 18.1 Serena), I've noticed that regardless of where the ServerSync jar is run from, the files are always downloaded to my home (~/
) directory. I've tried relocating it to various places, worried that it was somehow a permissions issue (currently it's located at /home/$USER/Documents/Minecraft/ForgeServ
), but it's maintained this same behavior in my Downloads folder, .minecraft, and pretty much anywhere else I put it.
To further assist your debug, it's also not reading in any configs from the directory it's installed in either: If $SS
is the directory where the serversync jar is located, then the config I'm referring to is in $SS/config/serversync
, and serversync-client.cfg isn't being read at all on startup either.
I've used ServerSync extensively in Windows and macOS, and it works beautifully there, so I have a feeling I understand its intended behavior, but if I'm missing something please let me know!
Logs not attached; did not throw any errors or crash
You are quite right, it should be using relative directories.
If SS is always searching in home then it's probably also trying to load it's config from home ๐, I was wondering if this would hit Linux issues.
Time to delve back into the depths of java IO.
Seems like the working directory that SS is running in is always set to home in this case. Probably will have to build in a check to make sure that the working dir is actually where SS was run from, or try to get the location of the jar file itself.
From what I have read so far Java does not give you a particularly nice way to get the location of the executed jar file.
@oitsjustjose
How are you launching SS at the moment?
Hmm yeah will be SS goobering where the working dir is on linux then. Tinkering time.
Derp. That was it. Still getting used to working directories in Linux, and how the JVM doesn't seem to like them at all :|
Did some testing on a Linux VM running mint (Serena 18.1), seems to run as expected with the proper paths.
I can add alternative ways of finding serversyncs jar file however there may be a deeper problem here than SS. I did notice that by default double clicking SS in mint just opens it as a package file.
Have you tried running SS from a terminal?
For trivia purposes:
This was most likely happening as SS is using "." to get its relative directory. This however will get the directory that SS was called from rather than where the jar file is.
Normally this would be fine however in this case I'm guessing that the implementation of 'double click run' for jar files was doing something like:
- ~/home java -jar absolute_path_to_serversync
Which would cause Paths.get(".") to give you ~/home rather than the desired end point.
This is still a potential bug so I might keep it open to track adding some fallback options