aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/make_archive.py
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-16 19:47:02 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit5176eaba81f4cda6cd5a14108c3516abd8ba0c84 (patch)
treefecfb6feb4ecfc45b00a59716a8275f69d889c30 /backends/networking/make_archive.py
parent43071c09723472483af4b69cf454ca75a8cd4613 (diff)
downloadscummvm-rg350-5176eaba81f4cda6cd5a14108c3516abd8ba0c84.tar.gz
scummvm-rg350-5176eaba81f4cda6cd5a14108c3516abd8ba0c84.tar.bz2
scummvm-rg350-5176eaba81f4cda6cd5a14108c3516abd8ba0c84.zip
CLOUD: Add wwwroot
wwwroot.zip contains ScummVM local webserver's resources, such as template html pages, styles and images. One can make it from wwwroot directory contents by running make_archive.py script. It's added to scummvm.rc, so it's included in the executable (it works with MinGW, but I was unable to do that in VS yet). IndexPageHandler is the one who returns these resources. It uses index.html for "/". I'm replacing "{message}" with translated message, so that's the way I thought the templates should work.
Diffstat (limited to 'backends/networking/make_archive.py')
-rw-r--r--backends/networking/make_archive.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/backends/networking/make_archive.py b/backends/networking/make_archive.py
new file mode 100644
index 0000000000..72d3b01d80
--- /dev/null
+++ b/backends/networking/make_archive.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# encoding: utf-8
+import sys
+import re
+import os
+import zipfile
+
+ARCHIVE_FILE_EXTENSIONS = ('.html', '.css', '.js', '.ico', '.png')
+
+def buildArchive(archiveName):
+ if not os.path.isdir(archiveName):
+ print ("Invalid archive name: " + archiveName)
+ return
+
+ zf = zipfile.ZipFile(archiveName + ".zip", 'w')
+
+ print ("Building '" + archiveName + "' archive:")
+ os.chdir(archiveName)
+
+ filenames = os.listdir('.')
+ filenames.sort()
+ for filename in filenames:
+ if os.path.isfile(filename) and not filename[0] == '.' and filename.endswith(ARCHIVE_FILE_EXTENSIONS):
+ zf.write(filename, './' + filename)
+ print (" Adding file: " + filename)
+
+ os.chdir('../')
+
+ zf.close()
+
+def main():
+ buildArchive("wwwroot")
+
+if __name__ == "__main__":
+ sys.exit(main())