--- a/src/eric7/RemoteServerInterface/EricServerFileSystemInterface.py Sun Feb 18 12:23:14 2024 +0100 +++ b/src/eric7/RemoteServerInterface/EricServerFileSystemInterface.py Sun Feb 18 17:31:14 2024 +0100 @@ -767,8 +767,15 @@ @rtype tuple of (str, str) """ if self.__serverInterface.isServerConnected(): - i = p.rfind(self.__serverPathSep) + 1 - head, tail = p[:i], p[i:] + if self.__serverPathSep == "\\": + # remote is a Windows system + normp = p.replace("/", "\\") + else: + # remote is a Posix system + normp = p.replace("\\", "/") + + i = normp.rfind(self.__serverPathSep) + 1 + head, tail = normp[:i], normp[i:] if head and head != self.__serverPathSep * len(head): head = head.rstrip(self.__serverPathSep) return head, tail @@ -787,6 +794,33 @@ """ return os.path.splitext(p) + def splitdrive(self, p): + """ + Public method to split a path into drive and path. + + @param p path name to be split + @type str + @return tuple containing the drive letter (incl. colon) and the path + @rtype tuple of (str, str) + """ + if self.__serverInterface.isServerConnected(): + plainp = FileSystemUtilities.plainFileName(p) + + if self.__serverPathSep == "\\": + # remote is a Windows system + normp = plainp.replace("/", "\\") + if normp[1:2] == ":": + return normp[:2], normp[2:] + else: + return "", normp + else: + # remote is a Posix system + normp = plainp.replace("\\", "/") + return "", normp + + else: + return os.path.splitdrive(p) + def dirname(self, p): """ Public method to extract the directory component of a path name.