mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
refactor: clean up the default app, add CSP (#13437)
* refactor: clean up the default app, add CSP * chore: appease the linter * refactor: make js2asar more generic, dont assume default_app as target
This commit is contained in:
@@ -16,14 +16,18 @@ def main():
|
||||
source_files = sys.argv[3:]
|
||||
|
||||
output_dir = tempfile.mkdtemp()
|
||||
copy_files(source_files, output_dir)
|
||||
copy_files(source_files, output_dir, folder_name)
|
||||
call_asar(archive, os.path.join(output_dir, folder_name))
|
||||
shutil.rmtree(output_dir)
|
||||
|
||||
|
||||
def copy_files(source_files, output_dir):
|
||||
def copy_files(source_files, output_dir, folder_name):
|
||||
for source_file in source_files:
|
||||
output_path = os.path.join(output_dir, source_file)
|
||||
# Files that aren't in the default_app folder need to be put inside
|
||||
# the temp one we are making so they end up in the ASAR
|
||||
if not source_file.startswith(folder_name + "/"):
|
||||
output_path = os.path.join(output_dir, folder_name, source_file)
|
||||
safe_mkdir(os.path.dirname(output_path))
|
||||
shutil.copy2(source_file, output_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user