Add version file
This commit is contained in:
parent
1fbdd69771
commit
2c0cac125c
6 changed files with 83 additions and 45 deletions
2
backend/Cargo.lock
generated
2
backend/Cargo.lock
generated
|
@ -1095,7 +1095,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "powertools"
|
||||
version = "1.3.0-beta1"
|
||||
version = "1.3.0-beta2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"libryzenadj",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "powertools"
|
||||
version = "1.3.0-beta1"
|
||||
version = "1.3.0-beta2"
|
||||
edition = "2021"
|
||||
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
|
||||
description = "Backend (superuser) functionality for PowerTools"
|
||||
|
|
|
@ -58,6 +58,13 @@ fn main() -> Result<(), ()> {
|
|||
|
||||
log::info!("home dir: {:?}", usdpl_back::api::dirs::home());
|
||||
|
||||
log::info!("Last version file: {}", utility::read_version_file());
|
||||
if let Err(e) = utility::save_version_file() {
|
||||
log::error!("Error storing version: {}", e);
|
||||
} else {
|
||||
log::info!("Updated version file succesfully");
|
||||
}
|
||||
|
||||
let _limits_handle = crate::settings::limits_worker_spawn();
|
||||
log::info!("Detected device automatically, starting with driver: {:?} (This can be overriden)", crate::settings::auto_detect_provider());
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ use std::fmt::Display;
|
|||
//use std::sync::{LockResult, MutexGuard};
|
||||
//use std::fs::{Permissions, metadata};
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::io::{Write, Read};
|
||||
|
||||
pub fn unwrap_maybe_fatal<T: Sized, E: Display>(result: Result<T, E>, message: &str) -> T {
|
||||
match result {
|
||||
|
@ -53,3 +54,33 @@ pub fn chown_settings_dir() -> std::io::Result<()> {
|
|||
.output()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn version_filepath() -> std::path::PathBuf {
|
||||
settings_dir().join(".version")
|
||||
}
|
||||
|
||||
pub fn save_version_file() -> std::io::Result<usize> {
|
||||
let path = version_filepath();
|
||||
std::fs::File::create(path)?
|
||||
.write(crate::consts::PACKAGE_VERSION.as_bytes())
|
||||
}
|
||||
|
||||
pub fn read_version_file() -> String {
|
||||
let path = version_filepath();
|
||||
match std::fs::File::open(path) {
|
||||
Ok(mut file) => {
|
||||
let mut read_version = String::new();
|
||||
match file.read_to_string(&mut read_version) {
|
||||
Ok(_) => read_version,
|
||||
Err(e) => {
|
||||
log::warn!("Cannot read version file str: {}", e);
|
||||
crate::consts::PACKAGE_VERSION.to_owned()
|
||||
}
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
log::warn!("Cannot read version file: {}", e);
|
||||
crate::consts::PACKAGE_VERSION.to_owned()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "PowerTools",
|
||||
"version": "1.3.0-beta1",
|
||||
"version": "1.3.0-beta2",
|
||||
"description": "Power tweaks for power users",
|
||||
"scripts": {
|
||||
"build": "shx rm -rf dist && rollup -c",
|
||||
|
@ -31,7 +31,7 @@
|
|||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"@rollup/plugin-typescript": "^8.5.0",
|
||||
"@types/react": "16.14.0",
|
||||
"@types/webpack": "^5.28.0",
|
||||
"@types/webpack": "^5.28.1",
|
||||
"rollup": "^2.79.1",
|
||||
"rollup-plugin-import-assets": "^1.1.1",
|
||||
"shx": "^0.3.4",
|
||||
|
@ -39,7 +39,7 @@
|
|||
"typescript": "^4.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"decky-frontend-lib": "~3.19.1",
|
||||
"decky-frontend-lib": "~3.19.2",
|
||||
"react-icons": "^4.8.0",
|
||||
"usdpl-front": "file:src/usdpl_front"
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ specifiers:
|
|||
'@rollup/plugin-replace': ^4.0.0
|
||||
'@rollup/plugin-typescript': ^8.5.0
|
||||
'@types/react': 16.14.0
|
||||
'@types/webpack': ^5.28.0
|
||||
decky-frontend-lib: ~3.19.1
|
||||
'@types/webpack': ^5.28.1
|
||||
decky-frontend-lib: ~3.19.2
|
||||
react-icons: ^4.8.0
|
||||
rollup: ^2.79.1
|
||||
rollup-plugin-import-assets: ^1.1.1
|
||||
|
@ -18,7 +18,7 @@ specifiers:
|
|||
usdpl-front: file:src/usdpl_front
|
||||
|
||||
dependencies:
|
||||
decky-frontend-lib: 3.19.1
|
||||
decky-frontend-lib: 3.19.2
|
||||
react-icons: 4.8.0
|
||||
usdpl-front: file:src/usdpl_front
|
||||
|
||||
|
@ -29,7 +29,7 @@ devDependencies:
|
|||
'@rollup/plugin-replace': 4.0.0_rollup@2.79.1
|
||||
'@rollup/plugin-typescript': 8.5.0_bhcmvni67fkldpaxrtldxbogce
|
||||
'@types/react': 16.14.0
|
||||
'@types/webpack': 5.28.0
|
||||
'@types/webpack': 5.28.1
|
||||
rollup: 2.79.1
|
||||
rollup-plugin-import-assets: 1.1.1_rollup@2.79.1
|
||||
shx: 0.3.4
|
||||
|
@ -108,7 +108,7 @@ packages:
|
|||
dependencies:
|
||||
'@rollup/pluginutils': 3.1.0_rollup@2.79.1
|
||||
'@types/resolve': 1.17.1
|
||||
deepmerge: 4.3.0
|
||||
deepmerge: 4.3.1
|
||||
is-builtin-module: 3.2.1
|
||||
is-module: 1.0.0
|
||||
resolve: 1.22.1
|
||||
|
@ -158,12 +158,12 @@ packages:
|
|||
/@types/eslint-scope/3.7.4:
|
||||
resolution: {integrity: sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==}
|
||||
dependencies:
|
||||
'@types/eslint': 8.21.1
|
||||
'@types/eslint': 8.21.3
|
||||
'@types/estree': 0.0.51
|
||||
dev: true
|
||||
|
||||
/@types/eslint/8.21.1:
|
||||
resolution: {integrity: sha512-rc9K8ZpVjNcLs8Fp0dkozd5Pt2Apk1glO4Vgz8ix1u6yFByxfqo5Yavpy65o+93TAe24jr7v+eSBtFLvOQtCRQ==}
|
||||
/@types/eslint/8.21.3:
|
||||
resolution: {integrity: sha512-fa7GkppZVEByMWGbTtE5MbmXWJTVbrjjaS8K6uQj+XtuuUv1fsuPAxhygfqLmsb/Ufb3CV8deFCpiMfAgi00Sw==}
|
||||
dependencies:
|
||||
'@types/estree': 0.0.51
|
||||
'@types/json-schema': 7.0.11
|
||||
|
@ -185,8 +185,8 @@ packages:
|
|||
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
|
||||
dev: true
|
||||
|
||||
/@types/node/18.14.6:
|
||||
resolution: {integrity: sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==}
|
||||
/@types/node/18.15.10:
|
||||
resolution: {integrity: sha512-9avDaQJczATcXgfmMAW3MIWArOO7A+m90vuCFLr8AotWf8igO/mRoYukrk2cqZVtv38tHs33retzHEilM7FpeQ==}
|
||||
dev: true
|
||||
|
||||
/@types/prop-types/15.7.5:
|
||||
|
@ -203,15 +203,15 @@ packages:
|
|||
/@types/resolve/1.17.1:
|
||||
resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==}
|
||||
dependencies:
|
||||
'@types/node': 18.14.6
|
||||
'@types/node': 18.15.10
|
||||
dev: true
|
||||
|
||||
/@types/webpack/5.28.0:
|
||||
resolution: {integrity: sha512-8cP0CzcxUiFuA9xGJkfeVpqmWTk9nx6CWwamRGCj95ph1SmlRRk9KlCZ6avhCbZd4L68LvYT6l1kpdEnQXrF8w==}
|
||||
/@types/webpack/5.28.1:
|
||||
resolution: {integrity: sha512-qw1MqGZclCoBrpiSe/hokSgQM/su8Ocpl3L/YHE0L6moyaypg4+5F7Uzq7NgaPKPxUxUbQ4fLPLpDWdR27bCZw==}
|
||||
dependencies:
|
||||
'@types/node': 18.14.6
|
||||
'@types/node': 18.15.10
|
||||
tapable: 2.2.1
|
||||
webpack: 5.75.0
|
||||
webpack: 5.76.3
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
- esbuild
|
||||
|
@ -380,8 +380,8 @@ packages:
|
|||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
caniuse-lite: 1.0.30001460
|
||||
electron-to-chromium: 1.4.320
|
||||
caniuse-lite: 1.0.30001470
|
||||
electron-to-chromium: 1.4.341
|
||||
node-releases: 2.0.10
|
||||
update-browserslist-db: 1.0.10_browserslist@4.21.5
|
||||
dev: true
|
||||
|
@ -395,8 +395,8 @@ packages:
|
|||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/caniuse-lite/1.0.30001460:
|
||||
resolution: {integrity: sha512-Bud7abqjvEjipUkpLs4D7gR0l8hBYBHoa+tGtKJHvT2AYzLp1z7EmVkUT4ERpVUfca8S2HGIVs883D8pUH1ZzQ==}
|
||||
/caniuse-lite/1.0.30001470:
|
||||
resolution: {integrity: sha512-065uNwY6QtHCBOExzbV6m236DDhYCCtPmQUCoQtwkVqzud8v5QPidoMr6CoMkC2nfp6nksjttqWQRRh75LqUmA==}
|
||||
dev: true
|
||||
|
||||
/chrome-trace-event/1.0.3:
|
||||
|
@ -420,24 +420,24 @@ packages:
|
|||
resolution: {integrity: sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==}
|
||||
dev: true
|
||||
|
||||
/decky-frontend-lib/3.19.1:
|
||||
resolution: {integrity: sha512-hU4+EFs74MGzUCv8l1AO2+EBj9RRbnpU19Crm4u+3lbLu6d63U2GsUeQ9ssmNRcOMY1OuVZkRoZBE58soOBJ3A==}
|
||||
/decky-frontend-lib/3.19.2:
|
||||
resolution: {integrity: sha512-J8QYlzi+FEwwoDxoUOhq+BvRO1bdg8O60oxyfcRF7nLalGPrRyaXx4MNNP117X/RY7smPF1xigjglNthdv9Yzw==}
|
||||
dev: false
|
||||
|
||||
/deepmerge/4.3.0:
|
||||
resolution: {integrity: sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og==}
|
||||
/deepmerge/4.3.1:
|
||||
resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/electron-to-chromium/1.4.320:
|
||||
resolution: {integrity: sha512-h70iRscrNluMZPVICXYl5SSB+rBKo22XfuIS1ER0OQxQZpKTnFpuS6coj7wY9M/3trv7OR88rRMOlKmRvDty7Q==}
|
||||
/electron-to-chromium/1.4.341:
|
||||
resolution: {integrity: sha512-R4A8VfUBQY9WmAhuqY5tjHRf5fH2AAf6vqitBOE0y6u2PgHgqHSrhZmu78dIX3fVZtjqlwJNX1i2zwC3VpHtQQ==}
|
||||
dev: true
|
||||
|
||||
/enhanced-resolve/5.12.0:
|
||||
resolution: {integrity: sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
dependencies:
|
||||
graceful-fs: 4.2.10
|
||||
graceful-fs: 4.2.11
|
||||
tapable: 2.2.1
|
||||
dev: true
|
||||
|
||||
|
@ -531,8 +531,8 @@ packages:
|
|||
path-is-absolute: 1.0.1
|
||||
dev: true
|
||||
|
||||
/graceful-fs/4.2.10:
|
||||
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
|
||||
/graceful-fs/4.2.11:
|
||||
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
|
||||
dev: true
|
||||
|
||||
/has-flag/4.0.0:
|
||||
|
@ -590,7 +590,7 @@ packages:
|
|||
resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
dependencies:
|
||||
'@types/node': 18.14.6
|
||||
'@types/node': 18.15.10
|
||||
merge-stream: 2.0.0
|
||||
supports-color: 8.1.1
|
||||
dev: true
|
||||
|
@ -801,8 +801,8 @@ packages:
|
|||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/terser-webpack-plugin/5.3.6_webpack@5.75.0:
|
||||
resolution: {integrity: sha512-kfLFk+PoLUQIbLmB1+PZDMRSZS99Mp+/MHqDNmMA6tOItzRt+Npe3E+fsMs5mfcM0wCtrrdU387UnV+vnSffXQ==}
|
||||
/terser-webpack-plugin/5.3.7_webpack@5.76.3:
|
||||
resolution: {integrity: sha512-AfKwIktyP7Cu50xNjXF/6Qb5lBNzYaWpU6YfoX3uZicTx0zTy0stDDCsvjDapKsSDvOeWo5MEq4TmdBy2cNoHw==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
peerDependencies:
|
||||
'@swc/core': '*'
|
||||
|
@ -821,12 +821,12 @@ packages:
|
|||
jest-worker: 27.5.1
|
||||
schema-utils: 3.1.1
|
||||
serialize-javascript: 6.0.1
|
||||
terser: 5.16.5
|
||||
webpack: 5.75.0
|
||||
terser: 5.16.8
|
||||
webpack: 5.76.3
|
||||
dev: true
|
||||
|
||||
/terser/5.16.5:
|
||||
resolution: {integrity: sha512-qcwfg4+RZa3YvlFh0qjifnzBHjKGNbtDo9yivMqMFDy9Q6FSaQWSB/j1xKhsoUFJIqDOM3TsN6D5xbrMrFcHbg==}
|
||||
/terser/5.16.8:
|
||||
resolution: {integrity: sha512-QI5g1E/ef7d+PsDifb+a6nnVgC4F22Bg6T0xrBrz6iloVB4PUkkunp6V8nzoOOZJIzjWVdAGqCdlKlhLq/TbIA==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
|
@ -872,7 +872,7 @@ packages:
|
|||
engines: {node: '>=10.13.0'}
|
||||
dependencies:
|
||||
glob-to-regexp: 0.4.1
|
||||
graceful-fs: 4.2.10
|
||||
graceful-fs: 4.2.11
|
||||
dev: true
|
||||
|
||||
/webpack-sources/3.2.3:
|
||||
|
@ -880,8 +880,8 @@ packages:
|
|||
engines: {node: '>=10.13.0'}
|
||||
dev: true
|
||||
|
||||
/webpack/5.75.0:
|
||||
resolution: {integrity: sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==}
|
||||
/webpack/5.76.3:
|
||||
resolution: {integrity: sha512-18Qv7uGPU8b2vqGeEEObnfICyw2g39CHlDEK4I7NK13LOur1d0HGmGNKGT58Eluwddpn3oEejwvBPoP4M7/KSA==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
|
@ -904,14 +904,14 @@ packages:
|
|||
eslint-scope: 5.1.1
|
||||
events: 3.3.0
|
||||
glob-to-regexp: 0.4.1
|
||||
graceful-fs: 4.2.10
|
||||
graceful-fs: 4.2.11
|
||||
json-parse-even-better-errors: 2.3.1
|
||||
loader-runner: 4.3.0
|
||||
mime-types: 2.1.35
|
||||
neo-async: 2.6.2
|
||||
schema-utils: 3.1.1
|
||||
tapable: 2.2.1
|
||||
terser-webpack-plugin: 5.3.6_webpack@5.75.0
|
||||
terser-webpack-plugin: 5.3.7_webpack@5.76.3
|
||||
watchpack: 2.4.0
|
||||
webpack-sources: 3.2.3
|
||||
transitivePeerDependencies:
|
||||
|
|
Loading…
Reference in a new issue