ide; fixed trailing path separator in project settings path validation. this is an...
authorRejean Loyer <rejean.loyer@gmail.com>
Thu, 23 May 2013 01:48:50 +0000 (21:48 -0400)
committerRejean Loyer <rejean.loyer@gmail.com>
Mon, 27 May 2013 17:15:22 +0000 (13:15 -0400)
ecere/src/com/String.ec
ide/src/ProjectSettings.ec

index 0ce03d4..addfbab 100644 (file)
@@ -623,6 +623,7 @@ public char * PathCat(char * string, char * addedPath)
 
 public char * MakePathRelative(char * path, char * to, char * destination)
 {
+   int len;
    // Don't process empty paths
    if(!path[0])
       memmove(destination, path, strlen(path)+1);
@@ -659,6 +660,9 @@ public char * MakePathRelative(char * path, char * to, char * destination)
          PathCat(destination, pathPart);
       }
    }
+   len = strlen(destination);
+   if(len>1 && (destination[len-1] == '/' || destination[len-1] == '\\'))
+      destination[--len] = '\0';
    return destination;
 }
 
index 1c4a517..93bf4f0 100644 (file)
@@ -980,13 +980,11 @@ static void FixPathOnPathBoxNotifyModified(PathBox pathBox)
       while((ch = *s++)) { if(!strchr(chars, ch)) *o++ = ch; }
       *o = '\0';
    }
-   len = strlen(path);
-   if(len>1 && path[len-1] == DIR_SEP)
-      path[--len] = '\0';
 #ifdef __WIN32__
    if(volumePath && path[0])
       path[1] = ':';
 #endif
+   len = strlen(path);
    if(len && !(path[0] == '.' && (len == 1 || (len == 2 && path[1] == DIR_SEP) || (len > 1 && path[1] == '.'))))
    {
       char cwdBackup[MAX_LOCATION];
@@ -1002,7 +1000,10 @@ static void FixPathOnPathBoxNotifyModified(PathBox pathBox)
          MakePathRelative(path, project.topNode.path, path);
       if(!path[0])
          strcpy(path, ".");
+      len = strlen(path);
    }
+   if(len>1 && path[len-1] == DIR_SEP)
+      path[--len] = '\0';
    pathBox.path = path;
 }