From 05cbf012e3a74ed9ad97fb83d55639b787adf823 Mon Sep 17 00:00:00 2001 From: sago007 Date: Fri, 30 Dec 2016 17:39:33 +0100 Subject: [PATCH] Moved the symlink logic in case of an invalid. Also deleted old outcommented logic. --- code/sys/sys_unix.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index e6248b07..aca2154d 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -150,6 +150,14 @@ static void CreateXDGPathAndMisc( void ) { Com_Printf("Failed to move \"%s\" to \"%s\". Error code: %d. Non fatal.", homeClassic, homeXdg, errCode); } } + if (!Sys_IsDir(homeXdg) && Sys_IsDir(homeClassic)) { + //Home classic does still exist and home Xdg does not. This means that the rename above must have failed. + //Link it istead + int errCode = symlink(homeClassic, homeXdg); + if (errCode) { + Com_Printf("Failed to create symbolic link \"%s\". Error code: %d. This is quite bad.", homeXdg, errCode); + } + } if (!Sys_IsDir(homeXdg)) { int errCode = Sys_Mkdir(homeXdg); if (errCode) { @@ -162,12 +170,6 @@ static void CreateXDGPathAndMisc( void ) { Com_Printf("Failed to create symbolic link \"%s\". Error code: %d. This is quite bad.", homeClassic, errCode); } } - if (!Sys_IsDir(homeXdg) && Sys_IsDir(homeClassic)) { - int errCode = symlink(homeClassic, homeXdg); - if (errCode) { - Com_Printf("Failed to create symbolic link \"%s\". Error code: %d. This is quite bad.", homeXdg, errCode); - } - } } /* @@ -193,12 +195,6 @@ const char *Sys_DefaultHomePath(void) else Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_MACOSX); #else -#if 0 - if(com_homepath->string[0]) - Q_strcat(homePath, sizeof(homePath), com_homepath->string); - else - Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_UNIX); -#endif CreateXDGPathAndMisc(); Com_sprintf(homePath, sizeof(homePath), "%s", homeXdg); #endif