From ade7cb7640484a73fc04924c1b3fed8ef482ca24 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Sat, 30 Sep 2023 13:15:35 -0400 Subject: [PATCH] fix paths --- .github/workflows/build-win.yml | 4 ++-- .github/workflows/build.yml | 2 +- backend/src/loader.py | 4 ++-- backend/src/main.py | 2 +- backend/src/updater.py | 3 ++- backend/src/utilities.py | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-win.yml b/.github/workflows/build-win.yml index 53d1e964e..1ce47d4a9 100644 --- a/.github/workflows/build-win.yml +++ b/.github/workflows/build-win.yml @@ -44,10 +44,10 @@ jobs: run: pnpm run build - name: Build Python Backend 🛠️ - run: pyinstaller --noconfirm --onefile --name "PluginLoader" --add-data "./backend/static;/backend/static" --add-data "./backend/locales;/backend/locales" --add-data "./backend/src/legacy;/backend/src/legacy" --add-data "./plugin;/plugin" --hidden-import=sqlite3 ./backend/main.py + run: pyinstaller --noconfirm --onefile --name "PluginLoader" --add-data "./backend/static;/static" --add-data "./backend/locales;/locales" --add-data "./backend/src/legacy;/src/legacy" --add-data "./plugin;/plugin" --hidden-import=sqlite3 ./backend/main.py - name: Build Python Backend (noconsole) 🛠️ - run: pyinstaller --noconfirm --noconsole --onefile --name "PluginLoader_noconsole" --add-data "./backend/static;/backend/static" --add-data "./backend/locales;/backend/locales" --add-data "./backend/src/legacy;/backend/src/legacy" --add-data "./plugin;/plugin" --hidden-import=sqlite3 ./backend/main.py + run: pyinstaller --noconfirm --noconsole --onefile --name "PluginLoader_noconsole" --add-data "./backend/static;/static" --add-data "./backend/locales;/locales" --add-data "./backend/src/legacy;/src/legacy" --add-data "./plugin;/plugin" --hidden-import=sqlite3 ./backend/main.py - name: Upload package artifact ⬆️ uses: actions/upload-artifact@v3 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 978acc4c6..2d617db39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,7 +87,7 @@ jobs: run: pnpm run build - name: Build Python Backend 🛠️ - run: pyinstaller --noconfirm --onefile --name "PluginLoader" --add-data ./backend/static:/backend/static --add-data ./backend/locales:/backend/locales --add-data ./backend/src/legacy:/backend/src/legacy --add-data ./plugin:/plugin --hidden-import=sqlite3 ./backend/main.py + run: pyinstaller --noconfirm --onefile --name "PluginLoader" --add-data ./backend/static:/static --add-data ./backend/locales:/locales --add-data ./backend/src/legacy:/src/legacy --add-data ./plugin:/plugin --hidden-import=sqlite3 ./backend/main.py - name: Upload package artifact ⬆️ if: ${{ !env.ACT }} diff --git a/backend/src/loader.py b/backend/src/loader.py index 684570f7d..e59cbcaff 100644 --- a/backend/src/loader.py +++ b/backend/src/loader.py @@ -107,13 +107,13 @@ async def enable_reload_wait(self): self.watcher.disabled = False async def handle_frontend_assets(self, request: web.Request): - file = path.join(path.dirname(__file__), "static", request.match_info["path"]) + file = path.join(path.dirname(__file__), "..", "static", request.match_info["path"]) return web.FileResponse(file, headers={"Cache-Control": "no-cache"}) async def handle_frontend_locales(self, request: web.Request): req_lang = request.match_info["path"] - file = path.join(path.dirname(__file__), "locales", req_lang) + file = path.join(path.dirname(__file__), "..", "locales", req_lang) if exists(file): return web.FileResponse(file, headers={"Cache-Control": "no-cache", "Content-Type": "application/json"}) else: diff --git a/backend/src/main.py b/backend/src/main.py index 793d000c2..83a4b9974 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -86,7 +86,7 @@ async def startup(_: Application): for route in list(self.web_app.router.routes()): self.cors.add(route) # type: ignore - self.web_app.add_routes([static("/static", path.join(path.dirname(__file__), 'static'))]) + self.web_app.add_routes([static("/static", path.join(path.dirname(__file__), '..', 'static'))]) self.web_app.add_routes([static("/legacy", path.join(path.dirname(__file__), 'legacy'))]) def exception_handler(self, loop: AbstractEventLoop, context: Dict[str, str]): diff --git a/backend/src/updater.py b/backend/src/updater.py index ac7c78d82..d28e67b0d 100644 --- a/backend/src/updater.py +++ b/backend/src/updater.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import shutil from asyncio import sleep @@ -11,7 +12,7 @@ from aiohttp import ClientSession, web -from .import helpers +from . import helpers from .injector import get_gamepadui_tab from .settings import SettingsManager diff --git a/backend/src/utilities.py b/backend/src/utilities.py index 3c7c8c2e1..b0e23b88d 100644 --- a/backend/src/utilities.py +++ b/backend/src/utilities.py @@ -19,7 +19,7 @@ from .main import PluginManager from .injector import inject_to_tab, get_gamepadui_tab, close_old_tabs, get_tab from .localplatform import ON_WINDOWS -from .import helpers +from . import helpers from .localplatform import service_stop, service_start, get_home_path, get_username class FilePickerObj(TypedDict):