feat: store packaged user data under data directory

This commit is contained in:
chengma
2026-07-07 14:12:32 +08:00
parent caa04a9aa7
commit 148c4a73eb
33 changed files with 602 additions and 196 deletions
+5 -2
View File
@@ -7,12 +7,14 @@ class PackagingTests(unittest.TestCase):
def read_text(self, relative_path):
return (REPO_ROOT / relative_path).read_text(encoding="utf-8")
def test_frozen_entrypoint_uses_exe_directory(self):
def test_frozen_entrypoint_keeps_program_and_data_paths_separate(self):
main_py = self.read_text("main.py")
gui_init = self.read_text("app/gui/__init__.py")
self.assertIn('getattr(sys, "frozen", False)', main_py)
self.assertIn("sys.executable", main_py)
self.assertIn("os.chdir(PROJECT_ROOT)", main_py)
self.assertNotIn("os.chdir(PROJECT_ROOT)", main_py)
self.assertIn("appconfig.prepare_data_dir()", gui_init)
def test_pyinstaller_spec_uses_onedir_without_local_datas(self):
spec = self.read_text("cmshopee.spec")
@@ -37,6 +39,7 @@ class PackagingTests(unittest.TestCase):
"logs",
"prompts",
"title_prompt.txt",
"data",
):
self.assertIn(token, script)