-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
use dev.dirs to calculate terasology directories #5284
base: develop
Are you sure you want to change the base?
Conversation
fe98759
to
a688903
Compare
It looks like the This may still be the better approach overall but I need to be sure that it will not make things worse for Windows users. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At a cursory glance, these changes appear to break several existing workflows, especially those using a different home directory.
engine/src/main/java/org/terasology/engine/core/PathManager.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/terasology/engine/core/PathManager.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/terasology/engine/core/PathManager.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/terasology/engine/core/PathManager.java
Outdated
Show resolved
Hide resolved
@@ -67,7 +65,7 @@ public final class PathManager { | |||
|
|||
private PathManager() { | |||
installPath = findInstallPath(); | |||
homePath = installPath; | |||
homePath = PROJECT_PATH; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
homePath = PROJECT_PATH; | |
homePath = installPath; |
findInstallPath()
provides a fallback path for unusual scenarios that I think we should keep. Defaulting to the current directory is normal for development anyway, I think. You can default to PROJECT_PATH
in findInstallPath
if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returning projectpath in a function called findinstallpath i thought is too much :) but let me digest your suggestion ...
if (homeDir != null) { | ||
logger.info("homeDir is {}", homeDir); | ||
PathManager.getInstance().useOverrideHomePath(homeDir); | ||
// TODO: what is this? | ||
// PathManager.getInstance().chooseHomePathManually(); | ||
} else { | ||
PathManager.getInstance().useDefaultHomePath(); | ||
} | ||
PathManager.getInstance().useDefaultHomePath(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not have been removed. Having the ability to override the game's home directory is important for testing with multiple clients.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this test done, or in other words, why setting XDG environment variables is not good enough?
logPath = homePath.resolve(LOG_DIR); | ||
shaderLogPath = logPath.resolve(SHADER_LOG_DIR); | ||
logPath = Paths.get(LOG_DIR); | ||
shaderLogPath = Paths.get(SHADER_LOG_DIR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are logPath
and shaderLogPath
absolute paths when all the other paths are relative to the home directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are
logPath
andshaderLogPath
absolute paths when all the other paths are relative to the home directory?
the reason why i like the new appdir / xdg / macos directory structure so much is that one can properly separate stuff which should be in a backup and what not. config i want to backup. shared data as well. local data not, but depends on the use case. cache and logs i never want a backup. coming back to your question: i did not see any harm at the moment to leave e.g. config in homedirectory, even it is not xdg compliant.
i share your concern, and put a comment on dirs-dev/directories-jvm#61, am thinking that one could make a pull request towards that library even ... and, i left a rant at microsofts openjdk, which i am less fond of: microsoft/openjdk#628. |
the library works according to the XDG standard, and offers translations for linux, macosx, windows. see for details: https://github.com/dirs-dev/directories-jvm fixes #5281. Co-authored-by: BenjaminAmos <[email protected]>
logPath = homePath.resolve(LOG_DIR); | ||
shaderLogPath = logPath.resolve(SHADER_LOG_DIR); | ||
logPath = Paths.get(LOG_DIR); | ||
shaderLogPath = Paths.get(SHADER_LOG_DIR); | ||
screenshotPath = homePath.resolve(SCREENSHOT_DIR); | ||
nativesPath = installPath.resolve(NATIVES_DIR); | ||
configsPath = homePath.resolve(CONFIGS_DIR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
configsPath = homePath.resolve(CONFIGS_DIR); | |
configsPath = Paths.get(CONFIGS_DIR); |
private static final String MODULE_DIR = "modules"; | ||
private static final String MODULE_CACHE_DIR = "cachedModules"; | ||
private static final String MODULE_CACHE_DIR = PROJECT_DIRS.cacheDir + "/cachedModules"; | ||
private static final String SCREENSHOT_DIR = "screenshots"; | ||
private static final String NATIVES_DIR = "natives"; | ||
private static final String CONFIGS_DIR = "configs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final String CONFIGS_DIR = "configs"; | |
private static final String CONFIGS_DIR = PROJECT_DIRS.configDir; |
the library works according to the XDG standard, and offers translations for linux, macosx, windows. see for details:
https://github.com/dirs-dev/directories-jvm
so ...