Hard link bundles if on same partition, else copy as before
This commit is contained in:
parent
0923a26853
commit
c24ea8311d
@ -38,11 +38,22 @@ class extractData:
|
|||||||
infoFiles.append(File)
|
infoFiles.append(File)
|
||||||
return infoFiles
|
return infoFiles
|
||||||
|
|
||||||
def copyBundle(self, bundleSrc, activityName):
|
def copyBundle(self, source, activityName):
|
||||||
shutil.copy2(
|
destination = self.websiteDir+"bundles/"+activityName+".xo"
|
||||||
bundleSrc,
|
# move this code block to a portable function
|
||||||
self.websiteDir+"bundles/"+activityName+".xo"
|
# copyFile(source, destination)
|
||||||
)
|
try:
|
||||||
|
# hard link if on same partition
|
||||||
|
os.link(source, destination)
|
||||||
|
except FileExistsError:
|
||||||
|
# FIXME: create a portable function to compare if two files
|
||||||
|
# are same and use it here
|
||||||
|
pass
|
||||||
|
except OSError:
|
||||||
|
# copy if on different partition
|
||||||
|
shutil.copy2(source, destination)
|
||||||
|
except Exception as unknownError:
|
||||||
|
raise unknownError
|
||||||
|
|
||||||
def createDirectories(self):
|
def createDirectories(self):
|
||||||
assert CreateDir(self.websiteDir+"app")
|
assert CreateDir(self.websiteDir+"app")
|
||||||
|
Loading…
Reference in New Issue
Block a user