All pastes #994733 Raw Edit

Anonymous

public text v1 · immutable
#994733 ·published 2008-04-23 16:51 UTC
rendered paste body
Index: FileTransfer.py
===================================================================
--- FileTransfer.py	(revision 1363)
+++ FileTransfer.py	(working copy)
@@ -219,16 +219,24 @@
                     # if we can't create the dir, we put the file directly 
                     # in received files dir
         
-        name = os.path.join(receivedFilesDir, self.getFilename())
+        #os.path.join(receivedFilesDir, self.getFilename())
+        path = receivedFilesDir+'/'
         
         num = 0
-        numstr = ''
+        increaseIt = self.getFilename()
         
-        while os.path.exists(name + numstr):
+        while os.path.exists(path + increaseIt):
             num += 1
-            numstr = '.' + str(num)
-
-        self.localPath = name + numstr
+            myFile = self.getFilename()
+            myLen = len(myFile)
+            lastDot = myFile.rfind(".")
+            lastChar = myLen-lastDot#12-9
+            second = myFile[lastDot:]
+            first = myFile[:-lastChar]
+            increaseIt=first+str(num)+second
+			
+			
+        self.localPath = path + increaseIt
         
         # we don't copy because the permissions may be too restrictive
         # and not match the user preferred umask blah blah