Fixed windows append isse
authorft
Wed, 09 Apr 2014 10:27:19 +0200
changeset 1474a3519ac9b3
parent 13 df3d231adebb
child 15 0b4d2bf9d306
Fixed windows append isse
removed useless modes
src/OsecFS.py
     1.1 --- a/src/OsecFS.py	Tue Apr 08 15:45:34 2014 +0200
     1.2 +++ b/src/OsecFS.py	Wed Apr 09 10:27:19 2014 +0200
     1.3 @@ -116,8 +116,10 @@
     1.4      md = {os.O_RDONLY: 'r', os.O_WRONLY: 'w', os.O_RDWR: 'w+'}
     1.5      m = md[flags & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR)]
     1.6  
     1.7 -    if flags | os.O_APPEND:
     1.8 -        m = m.replace('w', 'a', 1)
     1.9 +    # windows sets append even if it would overwrite the whole file (seek 0)
    1.10 +    # so ignore append option
    1.11 +    #if flags | os.O_APPEND:
    1.12 +    #    m = m.replace('w', 'a', 1)
    1.13  
    1.14      return m
    1.15  
    1.16 @@ -330,7 +332,7 @@
    1.17          if (config.get("Main", "ReadOnly") == "true"):
    1.18              sendReadOnlyNotification()
    1.19              return -errno.EACCES
    1.20 -        f = open (fixPath (path), "rw+")
    1.21 +        f = open (fixPath (path), "w+")
    1.22          f.truncate (length)
    1.23          f.close ()
    1.24  
    1.25 @@ -367,7 +369,7 @@
    1.26              return -errno.EACCES
    1.27          #self.file = os.fdopen (os.open (fixPath (path), flags, mode), flag2mode (flags))
    1.28          # fix strange Windows behaviour
    1.29 -        self.file = os.fdopen (os.open (fixPath (path), flags, mode), "rw+")
    1.30 +        self.file = os.fdopen (os.open (fixPath (path), flags, mode), "w+")
    1.31          self.fd = self.file.fileno ()
    1.32  
    1.33