Skip to content

Commit 337f052

Browse files
committed
add mini-file-server-root folder header
1 parent 4c94ed4 commit 337f052

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

simwrapper/MiniFileServer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
from SimpleHTTPServer import SimpleHTTPRequestHandler
1717

1818

19+
current_dir = os.getcwd()
20+
1921
def copy_byte_range(infile, outfile, start=None, stop=None, bufsize=16*1024):
2022
'''Like shutil.copyfileobj, but only copy a range of the streams.
2123
@@ -110,6 +112,7 @@ def end_headers(self):
110112
self.send_header("Access-Control-Allow-Methods", "GET,OPTIONS,HEAD")
111113
self.send_header("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store")
112114
self.send_header('Accept-Ranges', 'bytes')
115+
self.send_header('Mini-File-Server-Root', current_dir)
113116

114117
SimpleHTTPRequestHandler.end_headers(self)
115118

@@ -135,7 +138,7 @@ def find_free_port(port):
135138
def run_mini_file_server(port):
136139
print("\n-----------------------------------------------------------------")
137140
print("SimWrapper file server: port", port)
138-
print(os.getcwd())
141+
print(current_dir)
139142

140143
free_port = find_free_port(port)
141144

0 commit comments

Comments
 (0)