sigyllly commited on
Commit
883f32e
·
verified ·
1 Parent(s): 1dc363b

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -6
main.py CHANGED
@@ -15,7 +15,7 @@ BASE_DIR = os.path.abspath(os.path.dirname(__file__))
15
  UPLOAD_FOLDER = os.path.join(BASE_DIR, "uploads")
16
  COMPILE_FOLDER = os.path.join(BASE_DIR, "compile")
17
  STATS_FILE = "download_stats.json"
18
- NSIS_COMPILER_PATH = "/usr/local/bin/makensis"
19
  os.makedirs(UPLOAD_FOLDER, exist_ok=True)
20
  os.makedirs(COMPILE_FOLDER, exist_ok=True)
21
 
@@ -240,12 +240,20 @@ def save_stats(stats):
240
 
241
  def compile_nsi_script(nsi_file_path):
242
  """Compile the NSI script using NSIS compiler"""
243
- compile_cmd = [NSIS_COMPILER_PATH, nsi_file_path]
244
- compile_result = subprocess.run(compile_cmd, capture_output=True, text=True)
245
- if compile_result.returncode != 0:
246
- print(f"NSIS Compile Error: {compile_result.stderr}")
 
 
 
 
 
 
 
 
 
247
  return None
248
- return compile_result
249
 
250
  def get_current_installer():
251
  """Get the path of the most recent installer"""
 
15
  UPLOAD_FOLDER = os.path.join(BASE_DIR, "uploads")
16
  COMPILE_FOLDER = os.path.join(BASE_DIR, "compile")
17
  STATS_FILE = "download_stats.json"
18
+ NSIS_COMPILER = "makensis"
19
  os.makedirs(UPLOAD_FOLDER, exist_ok=True)
20
  os.makedirs(COMPILE_FOLDER, exist_ok=True)
21
 
 
240
 
241
  def compile_nsi_script(nsi_file_path):
242
  """Compile the NSI script using NSIS compiler"""
243
+ try:
244
+ # Use just the command name instead of full path
245
+ compile_cmd = [NSIS_COMPILER, nsi_file_path]
246
+ compile_result = subprocess.run(compile_cmd, capture_output=True, text=True)
247
+ if compile_result.returncode != 0:
248
+ print(f"NSIS Compile Error: {compile_result.stderr}")
249
+ return None
250
+ return compile_result
251
+ except subprocess.CalledProcessError as e:
252
+ print(f"Compilation failed: {str(e)}")
253
+ return None
254
+ except Exception as e:
255
+ print(f"Unexpected error during compilation: {str(e)}")
256
  return None
 
257
 
258
  def get_current_installer():
259
  """Get the path of the most recent installer"""