Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -43,6 +43,7 @@ def upload_files():
|
|
43 |
if bat_file.filename == '' or icon_file.filename == '':
|
44 |
return "No selected file", 400
|
45 |
|
|
|
46 |
bat_path = os.path.join(app.config['UPLOAD_FOLDER'], bat_file.filename)
|
47 |
icon_path = os.path.join(app.config['UPLOAD_FOLDER'], icon_file.filename)
|
48 |
|
@@ -50,7 +51,7 @@ def upload_files():
|
|
50 |
bat_file.save(bat_path)
|
51 |
icon_file.save(icon_path)
|
52 |
|
53 |
-
# Construct the NSIS script
|
54 |
nsi_script = f"""
|
55 |
!include nsDialogs.nsh
|
56 |
!include LogicLib.nsh
|
@@ -67,8 +68,8 @@ def upload_files():
|
|
67 |
|
68 |
Section "Install"
|
69 |
SetOutPath "$INSTDIR"
|
70 |
-
File "{bat_path}"
|
71 |
-
File "{icon_path}"
|
72 |
SectionEnd
|
73 |
"""
|
74 |
|
|
|
43 |
if bat_file.filename == '' or icon_file.filename == '':
|
44 |
return "No selected file", 400
|
45 |
|
46 |
+
# Define the paths to save the uploaded files
|
47 |
bat_path = os.path.join(app.config['UPLOAD_FOLDER'], bat_file.filename)
|
48 |
icon_path = os.path.join(app.config['UPLOAD_FOLDER'], icon_file.filename)
|
49 |
|
|
|
51 |
bat_file.save(bat_path)
|
52 |
icon_file.save(icon_path)
|
53 |
|
54 |
+
# Construct the NSIS script with the correct paths
|
55 |
nsi_script = f"""
|
56 |
!include nsDialogs.nsh
|
57 |
!include LogicLib.nsh
|
|
|
68 |
|
69 |
Section "Install"
|
70 |
SetOutPath "$INSTDIR"
|
71 |
+
File "{bat_path.replace('\\', '\\\\')}" # Escape backslashes for NSIS
|
72 |
+
File "{icon_path.replace('\\', '\\\\')}" # Escape backslashes for NSIS
|
73 |
SectionEnd
|
74 |
"""
|
75 |
|