Skip to content

Commit b8e5d2d

Browse files
author
jasonczc
committed
create_time
1 parent ad4062d commit b8e5d2d

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

Diff for: command.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def execute_command_map(user_name, path=""):
4141
res = global_cmd_map[args[0]]["function"](args)
4242
if not res:
4343
print(global_cmd_map[args[0]]["help"])
44-
except Exception:
45-
print(Exception)
44+
except Exception as err:
45+
print(err)
4646

4747

4848

Diff for: disk.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ def dir(args):
123123
file.TYPE_DICTIONARY: 'dictionary',
124124
file.TYPE_FILE: 'file'
125125
}
126-
tplt = "{0:{3}^10}\t{1:{3}^10}\t{2:^10}"
127-
print(tplt.format("type", "name", "permission", chr(12288)))
126+
tplt = "{0:^10}\t{1:{4}^10}\t{2:^20}\t{3:^30}"
127+
print(tplt.format("type", "name", "permission", "create_time", chr(12288)))
128128
for i in res.dic:
129129
permission = ""
130130
if i.tag == file.TYPE_FILE:
131131
permission = i.fcb.permission
132-
print(tplt.format(name_dic[i.tag], i.file_name, permission, chr(12288)))
132+
print(tplt.format(name_dic[i.tag], i.file_name, permission, time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(i.create_time)),chr(12288)))
133133
return True
134134

135135

@@ -430,6 +430,7 @@ def write_command(args):
430430
sid = usr_table.sid
431431
sys_table = system_open_file_table[sid]
432432
file_item = sys_table.dic_item
433+
sys_table.dic_item.last_modify_time = int(time.time())
433434
node_start = file_item.fcb.file_list
434435
while node_start.next is not None:
435436
node_start = node_start.next
@@ -590,10 +591,10 @@ def chmod_command(args):
590591
command.register_command("cd", cd, "/cd <path>")
591592
command.register_command("create", create, "/create <path>")
592593
command.register_command("mkdir", mkdir, "/mkdir <pathname>")
593-
command.register_command("open", open_command, "/open <pathname> <mode(1=readonly,2=writeonly,3=readwrite,4=runoly,7=all)>")
594+
command.register_command("open", open_command, "/open <pathname> <mode(1=readonly,2=writeonly,3=readwrite,4=runonly,7=all)>")
594595
command.register_command("close", close_command, "/close <uid>")
595596
command.register_command("read", read_command, "/read <uid>")
596597
command.register_command("write", write_command, "/write <uid> <stringbuffer>")
597598
command.register_command("mv", move_command, "/mv <ori_path> <new_path>")
598599
command.register_command("rm", delete_command, "/rm <path_name>")
599-
command.register_command("chmod", chmod_command, "/chmod <pathname> <mode(1=readonly,2=writeonly,3=readwrite,4=runoly,7=all)>")
600+
command.register_command("chmod", chmod_command, "/chmod <pathname> <mode(1=readonly,2=writeonly,3=readwrite,4=runonly,7=all)>")

Diff for: file.py

+2
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ def __init__(self):
2323
self.file_name = "" # 文件名
2424
self.fcb: FCB = None # FCB类型列表
2525
self.dic = [] # FileItem类型
26+
self.create_time = int(time.time())
27+
self.last_modify_time = int(time.time())
2628

0 commit comments

Comments
 (0)