fix path issue
This commit is contained in:
@@ -43,8 +43,8 @@ def generate_index(opts):
|
|||||||
f.write(get_header(opts.title))
|
f.write(get_header(opts.title))
|
||||||
if opts.parent:
|
if opts.parent:
|
||||||
f.write(get_pathlink('..'))
|
f.write(get_pathlink('..'))
|
||||||
for pa in dirs:
|
for di in dirs:
|
||||||
f.write(get_pathlink(pa))
|
f.write(get_pathlink(path,di))
|
||||||
for fi in files:
|
for fi in files:
|
||||||
f.write(get_filelink(path,fi))
|
f.write(get_filelink(path,fi))
|
||||||
f.write(get_footer())
|
f.write(get_footer())
|
||||||
@@ -58,10 +58,10 @@ def get_filelink(path,fname):
|
|||||||
fdstr=time.strftime("%Y/%m/%d %H:%M:%S",fdate)
|
fdstr=time.strftime("%Y/%m/%d %H:%M:%S",fdate)
|
||||||
return '<tr><td><a href="'+urllib.quote(fname)+'">'+fname+'</a><td class="right">'+fsstr+'</td><td class="right">'+fdstr+'</td></tr>\n'
|
return '<tr><td><a href="'+urllib.quote(fname)+'">'+fname+'</a><td class="right">'+fsstr+'</td><td class="right">'+fdstr+'</td></tr>\n'
|
||||||
|
|
||||||
def get_pathlink(path):
|
def get_pathlink(path,dname):
|
||||||
fdate=time.localtime(os.path.getmtime(path))
|
fdate=time.localtime(os.path.getmtime(os.path.join(path,dname)))
|
||||||
fdstr=time.strftime("%Y/%m/%d %H:%M:%S",fdate)
|
fdstr=time.strftime("%Y/%m/%d %H:%M:%S",fdate)
|
||||||
return '<tr><td><a href="'+urllib.quote(path)+'">'+path+'</a><td class="right">[DIR]</td><td class="right">'+fdstr+'</td></tr>\n'
|
return '<tr><td><a href="'+urllib.quote(dname)+'">'+dname+'</a><td class="right">[DIR]</td><td class="right">'+fdstr+'</td></tr>\n'
|
||||||
|
|
||||||
def get_header(title):
|
def get_header(title):
|
||||||
header='''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
header='''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||||
|
|||||||
Reference in New Issue
Block a user