diff --git a/LaunchScript/VirtualAcousticsStarterServer.py b/LaunchScript/VirtualAcousticsStarterServer.py index 078464829fb106903c0b5b6e14acd4805ccc6703..e47dc3a90b825d4ae633a1ad9cc6b24c3ec71e7e 100644 --- a/LaunchScript/VirtualAcousticsStarterServer.py +++ b/LaunchScript/VirtualAcousticsStarterServer.py @@ -408,16 +408,20 @@ class VirtualAcousticsLauncher: # Receives a file from a client, copies it to a tmp folder and returns the respective fullpath # Input is a string message starting with "file:" + # it has the content file:[RelativePathToFile]:[FileLengthInBytes]:[ModificationTimeInSecondsSinceEPOCH] def receive_file(self, sMessage): aMessageParts = sMessage.split(":") iBytesToReceive = int(aMessageParts[2]) + iLastModificationTime = int(aMessageParts[3]) Path, Filename = os.path.split(aMessageParts[1]) ProjectName = aMessageParts[3] Fullpath = os.path.join(self.sCurrentScriptsDirectory, "..", "tmp", ProjectName, Path, "") print("Should receive file: "+Filename+" in path "+Fullpath+ " with "+str(iBytesToReceive)+" bytes") - #check whether the file with this exact size already exists - if os.path.isfile(Fullpath+Filename) and os.stat(Fullpath+Filename).st_size==iBytesToReceive: + iLocalFileLastModification = os.path.getmtime(Fullpath+Filename) + + #check whether the file with this exact size (which is not older than the file to send) already exists + if os.path.isfile(Fullpath+Filename) and os.stat(Fullpath+Filename).st_size==iBytesToReceive and iLocalFileLastModification<iLastModificationTime: self.oLauncherConnection.send( b'exists' ) print("File already exists with this size, so no need for resending")