From 1681188214b9eae976e3bf7a24be01d4b10d65ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20BERTHO?= Date: Thu, 9 Nov 2023 23:15:32 +0100 Subject: [PATCH] Windows fix --- .comments/test.jpg.xml | 10 ---- .comments/test_2.jpg.xml | 10 ---- .gitignore | 103 +++------------------------------------ Justfile | 6 +-- smc.toml | 1 + src/main.rs | 6 ++- win-setup.iss | 6 +-- 7 files changed, 19 insertions(+), 123 deletions(-) delete mode 100644 .comments/test.jpg.xml delete mode 100644 .comments/test_2.jpg.xml diff --git a/.comments/test.jpg.xml b/.comments/test.jpg.xml deleted file mode 100644 index ec9aeba..0000000 --- a/.comments/test.jpg.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - -Projection: Equirectangular (2) -FOV: 360 x 62 -Ev: 13,14 - - - diff --git a/.comments/test_2.jpg.xml b/.comments/test_2.jpg.xml deleted file mode 100644 index 53e5f85..0000000 --- a/.comments/test_2.jpg.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - -Projection: Equirectangular (2) -FOV: 139 x 49 -Ev: 13,63 - - - diff --git a/.gitignore b/.gitignore index 35603c9..793d8fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,99 +1,3 @@ -# ---> Python -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -#*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# dotenv -.env - -# virtualenv -.venv -venv/ -ENV/ - -# Spyder project settings -.spyderproject - -# Rope project settings -.ropeproject - # Images *.jpg *.jpeg @@ -117,3 +21,10 @@ target/ # IDE .idea + +# Git +.git + +# Dist +/dist + diff --git a/Justfile b/Justfile index 9af1f96..fa05932 100644 --- a/Justfile +++ b/Justfile @@ -14,11 +14,11 @@ dist_linux: smc sources dist_win: - Remove-Item dist -Force -Recurse - New-Item -Path dist -Type Directory + coreutils rm -Rf ./dist + coreutils mkdir dist cargo build --release smc bin_win files smc sources pandoc -i LICENSE.md -s -o LICENSE.rtf Start-Process -FilePath "C:\Program Files (x86)\Inno Setup 6\compil32.exe" -ArgumentList "/cc", "win-setup.iss" -Wait - Get-FileHash "dist/SimplePanoramaViewer-2.0.0-x86_64-pc-windows-msvc-setup.exe" -Algorithm SHA512 | Select-Object -ExpandProperty Hash | Out-File "dist/SimplePanoramaViewer-2.0.0-x86_64-pc-windows-msvc-setup.exe.sha512sum" + Start-Process -WorkingDirectory dist coreutils -ArgumentList sha512sum, -b, "SimplePanoramaViewer-2.0.0-x86_64-pc-windows-msvc-setup.exe" -RedirectStandardOutput "dist/SimplePanoramaViewer-2.0.0-x86_64-pc-windows-msvc-setup.exe.sha512sum" diff --git a/smc.toml b/smc.toml index 0f048f9..6e01a4e 100644 --- a/smc.toml +++ b/smc.toml @@ -26,4 +26,5 @@ output = "./dist/SimplePanoramaViewer-2.0.0-src$EXT" container = "Tar" compression = "Zstd" compression_level = 15 +hidden = true signatures = ["Sha512"] \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index b57754d..c7193f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ use wry::{ event_loop::{ControlFlow, EventLoop}, window::WindowBuilder, }, - webview::WebViewBuilder, + webview::{WebContext, WebViewBuilder}, }; #[derive(RustEmbed)] @@ -85,8 +85,12 @@ fn main() -> Result<()> { .with_title("Simple panorama viewer") .with_maximized(true) .build(&event_loop)?; + let data_dir = directories::ProjectDirs::from("fr", "dalan", "SimplePanoramaViwer").unwrap(); let _webview = WebViewBuilder::new(window)? .with_url("http://127.0.0.1:62371/index.html")? + .with_web_context(&mut WebContext::new(Some( + data_dir.cache_dir().to_path_buf(), + ))) .build()?; info!("Event loop"); diff --git a/win-setup.iss b/win-setup.iss index 317d231..8d20216 100644 --- a/win-setup.iss +++ b/win-setup.iss @@ -5,7 +5,7 @@ #define MyAppVersion "2.0.0" #define MyAppPublisher "Dalan" #define MyAppURL "https://www.dalan.fr" -#define MyAppExeName "SimplePanoramaViewer.exe" +#define MyAppExeName "simple_panorama_viewer.exe" [Setup] ; NOTE: The value of AppId uniquely identifies this application. @@ -19,7 +19,7 @@ AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} -DefaultDirName={pf}\{#MyAppName} +DefaultDirName={commonpf}\{#MyAppName} DisableProgramGroupPage=yes LicenseFile=LICENSE.rtf OutputBaseFilename={#MyAppName}-{#MyAppVersion}-x86_64-pc-windows-msvc-setup @@ -37,7 +37,7 @@ Name: "french"; MessagesFile: "compiler:Languages\French.isl" Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] -Source: "dist\SimplePanoramaViewer\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "target\release\simple_panorama_viewer.exe"; DestDir: "{app}"; Flags: ignoreversion [Icons] Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"