Home | History | Annotate | Download | only in Core

Lines Matching refs:path

42     def __init__(self, action, path, mode=-1):

44 self.path = path
51 self.workspace = os.path.normpath(workspace)
53 self.zipfile = os.path.join(self.workspace, gBACKUPFILE)
60 def _save(self, tmp, path):
61 if not self._tryhook(path):
63 self.rlist.append(_PathInfo(tmp, path))
65 def bkrmfile(self, path):
66 arc = self._tryhook(path)
67 if arc and os.path.isfile(path):
69 self.zip.write(path, arc.encode('utf_8'))
70 sta = os.stat(path)
72 self.rlist.append(_PathInfo(_CHMOD, path, oldmode))
73 self.rlist.append(_PathInfo(_RMFILE, path))
74 __built_in_remove__(path)
76 def bkmkfile(self, path, mode, bufsize):
77 if not os.path.exists(path):
78 self._save(_MKFILE, path)
79 return __built_in_open__(path, mode, bufsize)
81 def bkrmdir(self, path):
82 if os.path.exists(path):
83 sta = os.stat(path)
85 self.rlist.append(_PathInfo(_CHMOD, path, oldmode))
86 self._save(_RMDIR, path)
87 __built_in_rmdir__(path)
89 def bkmkdir(self, path, mode):
90 if not os.path.exists(path):
91 self._save(_MKDIR, path)
92 __built_in_mkdir__(path, mode)
94 def bkchmod(self, path, mode):
95 if self._tryhook(path) and os.path.exists(path):
96 sta = os.stat(path)
98 self.rlist.append(_PathInfo(_CHMOD, path, oldmode))
99 __built_in_chmod__(path, mode)
108 exist = os.path.exists(item.path)
110 #if not os.access(item.path, os.W_OK):
111 # os.chmod(item.path, S_IWUSR)
112 __built_in_remove__(item.path)
116 arcname = os.path.normpath(item.path)
122 filep = __built_in_open__(item.path, "wb")
126 os.utime(item.path, (intime, intime))
130 __built_in_rmdir__(item.path)
137 __built_in_mkdir__(item.path)
140 __built_in_chmod__(item.path, item.mode)
151 # Check if path needs to be hooked
152 def _tryhook(self, path):
153 path = os.path.normpath(path)
155 if not path.startswith(works):
158 full = os.path.join(self.workspace, exceptdir)
159 if full == path or path.startswith(full + os.sep) or os.path.split(full)[0] == path:
161 return path[len(self.workspace)+1:]
163 def _hookrm(path):
165 GlobalData.gRECOVERMGR.bkrmfile(path)
167 __built_in_remove__(path)
169 def _hookmkdir(path, mode=0777):
171 GlobalData.gRECOVERMGR.bkmkdir(path, mode)
173 __built_in_mkdir__(path, mode)
175 def _hookrmdir(path):
177 GlobalData.gRECOVERMGR.bkrmdir(path)
179 __built_in_rmdir__(path)
181 def _hookmkfile(path, mode='r', bufsize=-1):
183 return GlobalData.gRECOVERMGR.bkmkfile(path, mode, bufsize)
184 return __built_in_open__(path, mode, bufsize)
186 def _hookchmod(path, mode):
188 GlobalData.gRECOVERMGR.bkchmod(path, mode)
190 __built_in_chmod__(path, mode)