Skip to content

Commit 1f90fa7

Browse files
author
Kazuki Suzuki Przyborowski
committed
Update pyarchivefile.py
1 parent e5bca1f commit 1f90fa7

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

pyarchivefile.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,6 +3403,8 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
34033403
fname = curfname
34043404
else:
34053405
fname = "./"+curfname
3406+
if(not os.path.exists(fname)):
3407+
return False
34063408
if(verbose):
34073409
VerbosePrintOut(fname)
34083410
if(not followlink or followlink is None):
@@ -3473,6 +3475,8 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
34733475
curfid = curfid + 1
34743476
if(ftype == 2):
34753477
flinkname = os.readlink(fname)
3478+
if(not os.path.exists(flinkname)):
3479+
return False
34763480
try:
34773481
fdev = fstatinfo.st_rdev
34783482
except AttributeError:
@@ -3583,6 +3587,8 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
35833587
fcontents.close()
35843588
fcontents = cfcontents
35853589
if(followlink and (ftype == 1 or ftype == 2)):
3590+
if(not os.path.exists(flinkname)):
3591+
return False
35863592
flstatinfo = os.stat(flinkname)
35873593
with open(flinkname, "rb") as fpc:
35883594
shutil.copyfileobj(fpc, fcontents)
@@ -3670,6 +3676,8 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
36703676
fname = curfname[3]
36713677
else:
36723678
fname = "./"+curfname[3]
3679+
if(not os.path.exists(fname)):
3680+
return False
36733681
fbasedir = os.path.dirname(fname)
36743682
flinkname = curfname[4]
36753683
fsize = format(curfname[5], 'x').lower()
@@ -4843,6 +4851,8 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
48434851
fname = curfname
48444852
else:
48454853
fname = "./"+curfname
4854+
if(not os.path.exists(fname)):
4855+
return False
48464856
if(verbose):
48474857
VerbosePrintOut(fname)
48484858
if(not followlink or followlink is None):
@@ -4913,6 +4923,8 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
49134923
curfid = curfid + 1
49144924
if(ftype == 2):
49154925
flinkname = os.readlink(fname)
4926+
if(not os.path.exists(flinkname)):
4927+
return False
49164928
try:
49174929
fdev = fstatinfo.st_rdev
49184930
except AttributeError:
@@ -5024,6 +5036,8 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
50245036
if(fcompression == "none"):
50255037
fcompression = ""
50265038
if(followlink and (ftype == 1 or ftype == 2)):
5039+
if(not os.path.exists(flinkname)):
5040+
return False
50275041
flstatinfo = os.stat(flinkname)
50285042
with open(flinkname, "rb") as fpc:
50295043
shutil.copyfileobj(fpc, fcontents)
@@ -7840,6 +7854,8 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, fmttype=__file_format_defau
78407854
fname = curfname
78417855
else:
78427856
fname = "./"+curfname
7857+
if(not os.path.exists(fname)):
7858+
return False
78437859
if(verbose):
78447860
VerbosePrintOut(fname)
78457861
if(not followlink or followlink is None):
@@ -7911,6 +7927,8 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, fmttype=__file_format_defau
79117927
curfid = curfid + 1
79127928
if(ftype == 2):
79137929
flinkname = os.readlink(fname)
7930+
if(not os.path.exists(flinkname)):
7931+
return False
79147932
try:
79157933
fdev = fstatinfo.st_rdev
79167934
except AttributeError:
@@ -7974,6 +7992,8 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, fmttype=__file_format_defau
79747992
fcsize = fcontents.tell()
79757993
fcencoding = GetFileEncoding(fcontents, False)
79767994
if(followlink and (ftype == 1 or ftype == 2)):
7995+
if(not os.path.exists(flinkname)):
7996+
return False
79777997
flstatinfo = os.stat(flinkname)
79787998
with open(flinkname, "rb") as fpc:
79797999
shutil.copyfileobj(fpc, fcontents)

0 commit comments

Comments
 (0)