Permalink
Browse files

ecere/ide: Moved IDE's eString_PathInsideOf to ecere::com::IsPathInsi…

…deOf
  • Loading branch information...
1 parent ad8e407 commit ae70201cb937d9a62c4ddc85ed5f26e58756b604 @jerstlouis jerstlouis committed Sep 3, 2012
Showing with 97 additions and 99 deletions.
  1. +25 −0 ecere/src/com/String.ec
  2. +64 −64 ide/locale/ide.pot
  3. +3 −28 ide/src/debugger/Debugger.ec
  4. +1 −1 ide/src/designer/CodeEditor.ec
  5. +1 −1 ide/src/ide.ec
  6. +3 −5 ide/src/project/Workspace.ec
View
@@ -1103,3 +1103,28 @@ public double FloatFromString(char * string)
}
return neg * res;
}
+
+public bool IsPathInsideOf(char * path, char * of)
+{
+ if(!path[0] || !of[0])
+ return false; // What to do here? Ever used?
+ else
+ {
+ char ofPart[MAX_FILENAME], ofRest[MAX_LOCATION];
+ char pathPart[MAX_FILENAME], pathRest[MAX_LOCATION];
+ strcpy(ofRest, of);
+ strcpy(pathRest, path);
+ for(; ofRest[0] && pathRest[0];)
+ {
+ SplitDirectory(ofRest, ofPart, ofRest);
+ SplitDirectory(pathRest, pathPart, pathRest);
+ if(fstrcmp(pathPart, ofPart))
+ return false;
+ }
+ if(!ofRest[0] && !pathRest[0]) // paths are identical - should return false or true? (changed to false)
+ return false;
+ else if(!pathRest[0]) // not inside of, it's the other way around
+ return false;
+ return true;
+ }
+}
Oops, something went wrong.

0 comments on commit ae70201

Please sign in to comment.