Ejemplo n.º 1
0
 def ToDosPathDirectConversion(self, path: str) -> str:
     """ This does not make the path relative to a root path """
     if path.find("\\") >= 0:
         raise UsageErrorException(
             "Backslash found in the supplied path '{0}'".format(path))
     path = Util.ChangeToDosEnvironmentVariables(path)
     return Util.UTF8ToAscii(path).replace('/', '\\')
Ejemplo n.º 2
0
 def ToBashPath(self, path: str) -> str:
     if path.find("\\") >= 0:
         raise UsageErrorException(
             "Backslash found in the supplied path '{0}'".format(path))
     for rootDir in self.RootDirectories:
         if path.startswith(rootDir.ResolvedPathEx):
             lenRootPath = len(rootDir.ResolvedPathEx)
             path = path[lenRootPath:]
             return rootDir.BashName + "/" + Util.UTF8ToAscii(path)
         elif path == rootDir.ResolvedPath:
             return rootDir.Name + "/"
     raise UsageErrorException(
         "the folder '{0}' does not reside inside one of the root dirs".
         format(path))
Ejemplo n.º 3
0
 def ToPath(rootDirectories: List[ToolConfigRootDirectory], path: str) -> str:
     """
     convert to a path that we know reside in one of the package roots
     """
     if path.find("\\") >= 0:
         raise UsageErrorException("Backslash found in the supplied path '{0}'".format(path))
     for rootDir in rootDirectories:
         if path.startswith(rootDir.ResolvedPathEx):
             lenRootPath = len(rootDir.ResolvedPathEx)
             path = path[lenRootPath:]
             return rootDir.Name + "/" + Util.UTF8ToAscii(path)
         elif path == rootDir.ResolvedPath:
             return rootDir.Name + "/"
     raise UsageErrorException("the folder '{0}' does not reside inside one of the root dirs".format(path))