This repository has been archived by the owner on Jul 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
328 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
imgs/*.psd | ||
imgs/*.psd | ||
.luacheckrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,41 @@ | ||
#!/usr/bin/python | ||
|
||
# Author: Stephen Leitnick | ||
# Date: July 22, 2017 | ||
|
||
# Date: February 12, 2019 | ||
|
||
import os | ||
import re | ||
import json | ||
|
||
filelistName = "filelist.json" | ||
|
||
prefix = "https://raw.githubusercontent.com/Sleitnick/AeroGameFramework/master/src/" | ||
emptyDirSuffix = "EMPTY" | ||
|
||
rootdir = os.path.join(".", "src") | ||
data = {} | ||
data["url"] = prefix | ||
data["paths"] = [] | ||
|
||
|
||
def fix_path(path): | ||
return path[len(rootdir) + 1:].replace("\\", "/") | ||
|
||
FILELIST_NAME = "filelist.json" | ||
FILELIST_MIN_NAME = "filelist.min.json" | ||
FILELIST_INDENT = 2 | ||
|
||
# Get all files: | ||
def get_all_files(): | ||
for subdir,dirs,files in os.walk(rootdir): | ||
if (len(files) == 0 and subdir != rootdir and len(dirs) == 0): | ||
data["paths"].append(fix_path(rootdir) + "/" + emptyDirSuffix) | ||
for file in files: | ||
path = fix_path(os.path.join(subdir, file)) | ||
data["paths"].append(path) | ||
FETCH_PREFIX = "https://raw.githubusercontent.com/Sleitnick/AeroGameFramework/master/" | ||
ROOT_DIR = os.path.join(".", "src") | ||
|
||
def path_to_dictionary(path): | ||
d = { | ||
"name": os.path.basename(path), | ||
"type": "file" | ||
} | ||
if os.path.isdir(path): | ||
d["type"] = "directory" | ||
d["children"] = [path_to_dictionary(os.path.join(path, p)) for p in os.listdir(path)] | ||
return d | ||
|
||
def write_to_filelist_file(): | ||
|
||
# Sort and concatenate array: | ||
data["paths"].sort(key=len) | ||
filelistStr = json.dumps(data, indent=4) | ||
|
||
# Write file: | ||
filelist = open(filelistName, "w") | ||
filelist.write(filelistStr) | ||
filelist.close() | ||
|
||
def write_json_to_file(filename, json_obj, indent): | ||
with open(filename, "w") as f: | ||
json.dump(json_obj, f, indent=FILELIST_INDENT if indent else None) | ||
|
||
def build(): | ||
get_all_files() | ||
write_to_filelist_file() | ||
|
||
|
||
build() | ||
print "File list built" | ||
data = { | ||
"url": FETCH_PREFIX, | ||
"paths": path_to_dictionary(ROOT_DIR) | ||
} | ||
write_json_to_file(FILELIST_NAME, data, True) | ||
write_json_to_file(FILELIST_MIN_NAME, data, False) | ||
|
||
if __name__ == "__main__": | ||
print("Building file list...") | ||
build() | ||
print("File list built") |
Oops, something went wrong.