mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-22 18:26:39 +00:00
Add config.ini to remember output folder
This commit is contained in:
parent
62c29308db
commit
b05c068e40
4 changed files with 73 additions and 25 deletions
2
host/config.ini
Normal file
2
host/config.ini
Normal file
|
@ -0,0 +1,2 @@
|
|||
[Directories]
|
||||
Output = /path/to/directory
|
|
@ -49,6 +49,8 @@ import usb.util
|
|||
import warnings
|
||||
import base64
|
||||
|
||||
import configparser
|
||||
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
from tkinter import filedialog, messagebox, font, scrolledtext
|
||||
|
@ -136,9 +138,14 @@ COPYRIGHT_TEXT = f'Copyright (c) {COPYRIGHT_YEAR}, {USB_DEV_MANUFACTURER}'
|
|||
SERVER_START_MSG = f'Please connect a Nintendo Switch console running {USB_DEV_PRODUCT}.'
|
||||
SERVER_STOP_MSG = f'Exit {USB_DEV_PRODUCT} on your console or disconnect it at any time to stop the server.'
|
||||
|
||||
# Load the configuration from the INI file
|
||||
config = configparser.ConfigParser()
|
||||
config.read('config.ini')
|
||||
|
||||
# Default directory paths.
|
||||
INITIAL_DIR = os.path.dirname(os.path.abspath(os.path.expanduser(os.path.expandvars(sys.argv[0]))))
|
||||
DEFAULT_DIR = os.path.join(INITIAL_DIR, USB_DEV_PRODUCT)
|
||||
# Get the default directory from the INI file or use a fallback if not present
|
||||
DEFAULT_DIR = config.get('Directories', 'Output', fallback=os.path.join(INITIAL_DIR, USB_DEV_PRODUCT))
|
||||
|
||||
# Application icon (PNG).
|
||||
# Embedded to load it as the icon for all windows using PhotoImage (which doesn't support ICO files) + wm_iconphoto.
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
@echo off
|
||||
|
||||
set scriptdir=%~dp0
|
||||
set scriptdir=%scriptdir:~0,-1%
|
||||
|
||||
set venvname=standalone
|
||||
set venvscripts=%scriptdir%\%venvname%\Scripts
|
||||
|
||||
set venvpython=%venvscripts%\python.exe
|
||||
|
||||
cd /D "%scriptdir%"
|
||||
|
||||
python -m venv "%venvname%"
|
||||
|
||||
"%venvpython%" -m pip install --upgrade nuitka -r requirements-win32.txt
|
||||
|
||||
"%venvpython%" -m nuitka --standalone --onefile --deployment --disable-console --windows-icon-from-ico=nxdt.ico --enable-plugin=tk-inter nxdt_host.py
|
||||
|
||||
rmdir /s /q nxdt_host.build
|
||||
rmdir /s /q nxdt_host.dist
|
||||
rmdir /s /q nxdt_host.onefile-build
|
||||
rmdir /s /q standalone
|
||||
|
||||
pause
|
||||
@echo off
|
||||
|
||||
set scriptdir=%~dp0
|
||||
set scriptdir=%scriptdir:~0,-1%
|
||||
|
||||
set venvname=standalone
|
||||
set venvscripts=%scriptdir%\%venvname%\Scripts
|
||||
|
||||
set venvpython=%venvscripts%\python.exe
|
||||
|
||||
cd /D "%scriptdir%"
|
||||
|
||||
python -m venv "%venvname%"
|
||||
|
||||
"%venvpython%" -m pip install --upgrade nuitka -r requirements-win32.txt
|
||||
|
||||
"%venvpython%" -m nuitka --standalone --onefile --deployment --disable-console --windows-icon-from-ico=nxdt.ico --enable-plugin=tk-inter nxdt_host.py
|
||||
|
||||
rmdir /s /q nxdt_host.build
|
||||
rmdir /s /q nxdt_host.dist
|
||||
rmdir /s /q nxdt_host.onefile-build
|
||||
rmdir /s /q standalone
|
||||
|
||||
pause
|
39
host/windows_make_standalone_PyInstaller.bat
Normal file
39
host/windows_make_standalone_PyInstaller.bat
Normal file
|
@ -0,0 +1,39 @@
|
|||
@echo off
|
||||
|
||||
rem Get the directory of the script
|
||||
set scriptdir=%~dp0
|
||||
set scriptdir=%scriptdir:~0,-1%
|
||||
|
||||
rem Set up virtual environment variables
|
||||
set venvname=standalone
|
||||
set venvdir=%scriptdir%\%venvname%
|
||||
|
||||
rem Create a virtual environment
|
||||
python -m venv "%venvdir%"
|
||||
|
||||
rem Activate the virtual environment
|
||||
call "%venvdir%\Scripts\activate"
|
||||
|
||||
rem Install PyInstaller
|
||||
pip install --upgrade pyinstaller
|
||||
|
||||
rem Install additional requirements
|
||||
pip install -r requirements-win32.txt
|
||||
|
||||
rem Use PyInstaller to create a standalone executable
|
||||
pyinstaller --onefile --noconsole --icon=nxdt.ico nxdt_host.py
|
||||
|
||||
rem Deactivate the virtual environment
|
||||
call deactivate
|
||||
|
||||
rem Move the executable to the script directory
|
||||
move "%scriptdir%\dist\nxdt_host.exe" "%scriptdir%"
|
||||
timeout /t 1 /nobreak > nul
|
||||
|
||||
rem Clean up temporary files
|
||||
rmdir /s /q "%scriptdir%\dist"
|
||||
rmdir /s /q "%scriptdir%\build"
|
||||
rmdir /s /q "%venvdir%"
|
||||
|
||||
rem Pause to keep the console window open for viewing output
|
||||
pause
|
Loading…
Reference in a new issue