163 |
if (Globals.resource_forks_write and rpin.isreg() and |
if (Globals.resource_forks_write and rpin.isreg() and |
164 |
rpin.has_resource_fork()): |
rpin.has_resource_fork()): |
165 |
rpout.write_resource_fork(rpin.get_resource_fork()) |
rpout.write_resource_fork(rpin.get_resource_fork()) |
166 |
if Globals.carbonfile_write and rpin.isreg(): |
if (Globals.carbonfile_write and rpin.isreg() and |
167 |
|
rpin.has_carbonfile()): |
168 |
rpout.write_carbonfile(rpin.get_carbonfile()) |
rpout.write_carbonfile(rpin.get_carbonfile()) |
169 |
if Globals.eas_write: rpout.write_ea(rpin.get_ea()) |
if Globals.eas_write: rpout.write_ea(rpin.get_ea()) |
170 |
rpout.chmod(rpin.getperms()) |
rpout.chmod(rpin.getperms()) |
186 |
if (Globals.resource_forks_write and rpin.isreg() and |
if (Globals.resource_forks_write and rpin.isreg() and |
187 |
rpin.has_resource_fork() and rpout.isreg()): |
rpin.has_resource_fork() and rpout.isreg()): |
188 |
rpout.write_resource_fork(rpin.get_resource_fork()) |
rpout.write_resource_fork(rpin.get_resource_fork()) |
189 |
if Globals.carbonfile_write and rpin.isreg() and rpout.isreg(): |
if (Globals.carbonfile_write and rpin.isreg() and |
190 |
|
rpin.has_carbonfile() and rpout.isreg()): |
191 |
rpout.write_carbonfile(rpin.get_carbonfile()) |
rpout.write_carbonfile(rpin.get_carbonfile()) |
192 |
if Globals.eas_write: rpout.write_ea(rpin.get_ea()) |
if Globals.eas_write: rpout.write_ea(rpin.get_ea()) |
193 |
if rpin.isdir() and not rpout.isdir(): |
if rpin.isdir() and not rpout.isdir(): |
1163 |
ea.write_to_rp(self) |
ea.write_to_rp(self) |
1164 |
self.data['ea'] = ea |
self.data['ea'] = ea |
1165 |
|
|
|
def get_carbonfile(self): |
|
|
"""Return resource fork data, loading from filesystem if |
|
|
necessary.""" |
|
|
from Carbon.File import FSSpec |
|
|
import MacOS |
|
|
try: return self.data['cfile'] |
|
|
except KeyError: pass |
|
|
|
|
|
try: |
|
|
fsobj = FSSpec(self.path) |
|
|
finderinfo = fsobj.FSpGetFInfo() |
|
|
cfile = {'creator': finderinfo.Creator, |
|
|
'type': finderinfo.Type, |
|
|
'location': finderinfo.Location, |
|
|
'flags': finderinfo.Flags} |
|
|
self.data['carbonfile'] = cfile |
|
|
return cfile |
|
|
except MacOS.Error: |
|
|
log.Log("Cannot read carbonfile information from %s" % |
|
|
(self.path,), 2) |
|
|
self.data['carbonfile'] = None |
|
|
return self.data['carbonfile'] |
|
|
|
|
1166 |
def write_carbonfile(self, cfile): |
def write_carbonfile(self, cfile): |
1167 |
"""Write new carbon data to self.""" |
"""Write new carbon data to self.""" |
1168 |
if not cfile: |
if not cfile: return |
|
# This should be made cleaner---if you know Mac OS X tell |
|
|
# me what could cause an error in get_carbonfile above |
|
|
return |
|
|
|
|
1169 |
log.Log("Writing carbon data to %s" % (self.index,), 7) |
log.Log("Writing carbon data to %s" % (self.index,), 7) |
1170 |
from Carbon.File import FSSpec |
from Carbon.File import FSSpec |
1171 |
import MacOS |
import MacOS |
1231 |
if Globals.acls_conn: rpath.data['acl'] = acl_get(rpath) |
if Globals.acls_conn: rpath.data['acl'] = acl_get(rpath) |
1232 |
if Globals.resource_forks_conn and rpath.isreg(): |
if Globals.resource_forks_conn and rpath.isreg(): |
1233 |
rpath.get_resource_fork() |
rpath.get_resource_fork() |
1234 |
if Globals.carbonfile_conn and rpath.isreg(): rpath.get_carbonfile() |
if Globals.carbonfile_conn and rpath.isreg(): |
1235 |
|
rpath.data['carbonfile'] = carbonfile_get(rpath) |
1236 |
|
|
1237 |
|
def carbonfile_get(rpath): |
1238 |
|
"""Return carbonfile value for local rpath""" |
1239 |
|
from Carbon.File import FSSpec |
1240 |
|
import MacOS |
1241 |
|
try: |
1242 |
|
fsobj = FSSpec(self.path) |
1243 |
|
finderinfo = fsobj.FSpGetFInfo() |
1244 |
|
cfile = {'creator': finderinfo.Creator, |
1245 |
|
'type': finderinfo.Type, |
1246 |
|
'location': finderinfo.Location, |
1247 |
|
'flags': finderinfo.Flags} |
1248 |
|
return cfile |
1249 |
|
except MacOS.Error: |
1250 |
|
log.Log("Cannot read carbonfile information from %s" % |
1251 |
|
(self.path,), 2) |
1252 |
|
return None |
1253 |
|
|
1254 |
|
|
1255 |
# These functions are overwritten by the eas_acls.py module. We can't |
# These functions are overwritten by the eas_acls.py module. We can't |