def GetFullNetworkPath(path): fullNetworkPath = None if not Path.IsPathRooted(path): raise ArgumentException("A full file path must be specified.", "path") pathRoot = Path.GetPathRoot(path) driveRemoteName = GetDriveRemoteName(pathRoot) if driveRemoteName is not None: pathWithoutRoot = path.Substring(pathRoot.Length) fullNetworkPath = Path.Combine(driveRemoteName, pathWithoutRoot) return fullNetworkPath
def GetSessionFilesData(sessionId, sessionFiles): sessionFilesData = { "sessionId": sessionId, "sessionFiles": [ ( path_util.ExpandedFullNetworkPath(filePath) if Path.IsPathRooted(filePath) # Cloud models 'paths' are not normal file paths so this accounts for that. else filePath) for filePath in sessionFiles ] } return sessionFilesData