Skip to content

Commit f4222dc

Browse files
author
Kazuki Suzuki Przyborowski
committed
Update pycatfile.py
1 parent 1096ee0 commit f4222dc

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

pycatfile.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3415,6 +3415,8 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
34153415
fname = curfname
34163416
else:
34173417
fname = "./"+curfname
3418+
if(not os.path.exists(fname)):
3419+
return False
34183420
if(verbose):
34193421
VerbosePrintOut(fname)
34203422
if(not followlink or followlink is None):
@@ -3485,6 +3487,8 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
34853487
curfid = curfid + 1
34863488
if(ftype == 2):
34873489
flinkname = os.readlink(fname)
3490+
if(not os.path.exists(flinkname)):
3491+
return False
34883492
try:
34893493
fdev = fstatinfo.st_rdev
34903494
except AttributeError:
@@ -3595,6 +3599,8 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
35953599
fcontents.close()
35963600
fcontents = cfcontents
35973601
if(followlink and (ftype == 1 or ftype == 2)):
3602+
if(not os.path.exists(flinkname)):
3603+
return False
35983604
flstatinfo = os.stat(flinkname)
35993605
with open(flinkname, "rb") as fpc:
36003606
shutil.copyfileobj(fpc, fcontents)
@@ -3682,6 +3688,8 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
36823688
fname = curfname[3]
36833689
else:
36843690
fname = "./"+curfname[3]
3691+
if(not os.path.exists(fname)):
3692+
return False
36853693
fbasedir = os.path.dirname(fname)
36863694
flinkname = curfname[4]
36873695
fsize = format(curfname[5], 'x').lower()
@@ -4855,6 +4863,8 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
48554863
fname = curfname
48564864
else:
48574865
fname = "./"+curfname
4866+
if(not os.path.exists(fname)):
4867+
return False
48584868
if(verbose):
48594869
VerbosePrintOut(fname)
48604870
if(not followlink or followlink is None):
@@ -4925,6 +4935,8 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
49254935
curfid = curfid + 1
49264936
if(ftype == 2):
49274937
flinkname = os.readlink(fname)
4938+
if(not os.path.exists(flinkname)):
4939+
return False
49284940
try:
49294941
fdev = fstatinfo.st_rdev
49304942
except AttributeError:
@@ -5036,6 +5048,8 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
50365048
if(fcompression == "none"):
50375049
fcompression = ""
50385050
if(followlink and (ftype == 1 or ftype == 2)):
5051+
if(not os.path.exists(flinkname)):
5052+
return False
50395053
flstatinfo = os.stat(flinkname)
50405054
with open(flinkname, "rb") as fpc:
50415055
shutil.copyfileobj(fpc, fcontents)
@@ -7852,6 +7866,8 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, fmttype=__file_format_defau
78527866
fname = curfname
78537867
else:
78547868
fname = "./"+curfname
7869+
if(not os.path.exists(fname)):
7870+
return False
78557871
if(verbose):
78567872
VerbosePrintOut(fname)
78577873
if(not followlink or followlink is None):
@@ -7923,6 +7939,8 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, fmttype=__file_format_defau
79237939
curfid = curfid + 1
79247940
if(ftype == 2):
79257941
flinkname = os.readlink(fname)
7942+
if(not os.path.exists(flinkname)):
7943+
return False
79267944
try:
79277945
fdev = fstatinfo.st_rdev
79287946
except AttributeError:
@@ -7986,6 +8004,8 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, fmttype=__file_format_defau
79868004
fcsize = fcontents.tell()
79878005
fcencoding = GetFileEncoding(fcontents, False)
79888006
if(followlink and (ftype == 1 or ftype == 2)):
8007+
if(not os.path.exists(flinkname)):
8008+
return False
79898009
flstatinfo = os.stat(flinkname)
79908010
with open(flinkname, "rb") as fpc:
79918011
shutil.copyfileobj(fpc, fcontents)

0 commit comments

Comments
 (0)