diff -r 0f4017309f35 -r b6f5e27daeb5 src/eric7/RemoteServer/EricServerFileSystemRequestHandler.py --- a/src/eric7/RemoteServer/EricServerFileSystemRequestHandler.py Fri Feb 23 16:50:50 2024 +0100 +++ b/src/eric7/RemoteServer/EricServerFileSystemRequestHandler.py Fri Feb 23 16:52:01 2024 +0100 @@ -10,6 +10,7 @@ import base64 import contextlib import os +import shutil import stat import time @@ -48,6 +49,8 @@ "ReadFile": self.__readFile, "WriteFile": self.__writeFile, "DirEntries": self.__dirEntries, + "ExpandUser": self.__expanduser, + "ShutilCopy": self.__shutilCopy, } def handleRequest(self, request, params, reqestUuid): @@ -400,3 +403,37 @@ "ok": True, "result": result, } + + def __expanduser(self, params): + """ + Private method to replace an initial component of ~ or ~user replaced. + + @param params dictionary containing the request data + @type dict + @return dictionary containing the reply data + @rtype dict + """ + return { + "ok": True, + "name": os.path.expanduser(params["name"]) + } + + def __shutilCopy(self, params): + """ + Private method to copy a source file to a destination file or directory. + + @param params dictionary containing the request data + @type dict + @return dictionary containing the reply data + @rtype dict + """ + try: + return { + "ok": True, + "dst": shutil.copy(params["src_name"], params["dst_name"]), + } + except OSError as err: + return { + "ok": False, + "error": str(err), + }