From bc97e851ecc4c6ac77c8a594c2623e50bf157b6a Mon Sep 17 00:00:00 2001 From: Philip Kristoffersen Date: Sat, 31 Dec 2022 09:01:44 +0100 Subject: [PATCH] Remove chrono and replace with time (#298) --- Cargo.lock | 168 +++++-------------------------- Cargo.toml | 8 +- flatpak/cargo-lock.json | 218 ++++++---------------------------------- src/ui/ui_backup.rs | 11 +- 4 files changed, 65 insertions(+), 340 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08f5aea..8efee64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -116,15 +116,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "arboard" version = "3.2.0" @@ -265,10 +256,9 @@ dependencies = [ [[package]] name = "boilr" -version = "1.7.14" +version = "1.7.15" dependencies = [ "base64 0.20.0", - "chrono", "color-eyre", "config", "copypasta", @@ -291,6 +281,7 @@ dependencies = [ "steam_shortcuts_util", "steamgriddb_api", "sysinfo", + "time", "tokio", "toml", "winreg", @@ -393,21 +384,6 @@ dependencies = [ "libc", ] -[[package]] -name = "chrono" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-integer", - "num-traits", - "time", - "wasm-bindgen", - "winapi", -] - [[package]] name = "clipboard-win" version = "3.1.1" @@ -469,16 +445,6 @@ dependencies = [ "objc", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "color-eyre" version = "0.6.2" @@ -723,50 +689,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" -[[package]] -name = "cxx" -version = "1.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "darling" version = "0.13.4" @@ -1571,30 +1493,6 @@ dependencies = [ "tokio-native-tls", ] -[[package]] -name = "iana-time-zone" -version = "0.1.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "winapi", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" -dependencies = [ - "cxx", - "cxx-build", -] - [[package]] name = "ident_case" version = "1.0.1" @@ -1783,15 +1681,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - [[package]] name = "linked-hash-map" version = "0.5.6" @@ -2657,12 +2546,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "scratch" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" - [[package]] name = "sctk-adwaita" version = "0.4.3" @@ -2975,15 +2858,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" version = "1.0.38" @@ -3035,13 +2909,29 @@ dependencies = [ [[package]] name = "time" -version = "0.1.45" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", + "itoa", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + +[[package]] +name = "time-macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +dependencies = [ + "time-core", ] [[package]] @@ -3241,12 +3131,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - [[package]] name = "url" version = "2.3.1" @@ -3315,12 +3199,6 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index d3e270a..53cf6ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,10 @@ [package] edition = "2021" name = "boilr" -version = "1.7.14" +version = "1.7.15" [dependencies] base64 = "^0.20.0" -chrono = "^0.4.23" config = "^0.13.3" copypasta = "^0.8.1" flate2 = "^1.0.25" @@ -20,6 +19,7 @@ sysinfo = "^0.27.1" eyre = "^0.6.8" color-eyre = "^0.6.2" dyn-clone = "^1.0.10" +time = {version="^0.3.17", features = ["formatting"]} [target."cfg(not(windows))".dependencies] openssl = { version = "*", features = ["vendored"] } @@ -57,8 +57,6 @@ version = "^1.23.0" [dependencies.toml] version = "^0.5.10" - -[target] [target."cfg(windows)"] [target."cfg(windows)".build-dependencies] winres = "^0.1.12" @@ -69,4 +67,4 @@ sqlite = "^0.30.3" [features] # This feature is enabled when building for a flatpak environment -flatpak = [] \ No newline at end of file +flatpak = [] diff --git a/flatpak/cargo-lock.json b/flatpak/cargo-lock.json index 0b40893..91c3e7b 100644 --- a/flatpak/cargo-lock.json +++ b/flatpak/cargo-lock.json @@ -142,19 +142,6 @@ "dest": "cargo/vendor/ahash-0.8.2", "dest-filename": ".cargo-checksum.json" }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/android_system_properties/android_system_properties-0.1.5.crate", - "sha256": "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311", - "dest": "cargo/vendor/android_system_properties-0.1.5" - }, - { - "type": "inline", - "contents": "{\"package\": \"819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311\", \"files\": {}}", - "dest": "cargo/vendor/android_system_properties-0.1.5", - "dest-filename": ".cargo-checksum.json" - }, { "type": "archive", "archive-type": "tar-gzip", @@ -545,19 +532,6 @@ "dest": "cargo/vendor/cgl-0.3.2", "dest-filename": ".cargo-checksum.json" }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/chrono/chrono-0.4.23.crate", - "sha256": "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f", - "dest": "cargo/vendor/chrono-0.4.23" - }, - { - "type": "inline", - "contents": "{\"package\": \"16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f\", \"files\": {}}", - "dest": "cargo/vendor/chrono-0.4.23", - "dest-filename": ".cargo-checksum.json" - }, { "type": "archive", "archive-type": "tar-gzip", @@ -623,19 +597,6 @@ "dest": "cargo/vendor/cocoa-foundation-0.1.0", "dest-filename": ".cargo-checksum.json" }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/codespan-reporting/codespan-reporting-0.11.1.crate", - "sha256": "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e", - "dest": "cargo/vendor/codespan-reporting-0.11.1" - }, - { - "type": "inline", - "contents": "{\"package\": \"3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e\", \"files\": {}}", - "dest": "cargo/vendor/codespan-reporting-0.11.1", - "dest-filename": ".cargo-checksum.json" - }, { "type": "archive", "archive-type": "tar-gzip", @@ -922,58 +883,6 @@ "dest": "cargo/vendor/cty-0.2.2", "dest-filename": ".cargo-checksum.json" }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/cxx/cxx-1.0.85.crate", - "sha256": "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd", - "dest": "cargo/vendor/cxx-1.0.85" - }, - { - "type": "inline", - "contents": "{\"package\": \"5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd\", \"files\": {}}", - "dest": "cargo/vendor/cxx-1.0.85", - "dest-filename": ".cargo-checksum.json" - }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/cxx-build/cxx-build-1.0.85.crate", - "sha256": "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0", - "dest": "cargo/vendor/cxx-build-1.0.85" - }, - { - "type": "inline", - "contents": "{\"package\": \"b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0\", \"files\": {}}", - "dest": "cargo/vendor/cxx-build-1.0.85", - "dest-filename": ".cargo-checksum.json" - }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/cxxbridge-flags/cxxbridge-flags-1.0.85.crate", - "sha256": "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59", - "dest": "cargo/vendor/cxxbridge-flags-1.0.85" - }, - { - "type": "inline", - "contents": "{\"package\": \"69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59\", \"files\": {}}", - "dest": "cargo/vendor/cxxbridge-flags-1.0.85", - "dest-filename": ".cargo-checksum.json" - }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/cxxbridge-macro/cxxbridge-macro-1.0.85.crate", - "sha256": "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6", - "dest": "cargo/vendor/cxxbridge-macro-1.0.85" - }, - { - "type": "inline", - "contents": "{\"package\": \"3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6\", \"files\": {}}", - "dest": "cargo/vendor/cxxbridge-macro-1.0.85", - "dest-filename": ".cargo-checksum.json" - }, { "type": "archive", "archive-type": "tar-gzip", @@ -1949,32 +1858,6 @@ "dest": "cargo/vendor/hyper-tls-0.5.0", "dest-filename": ".cargo-checksum.json" }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/iana-time-zone/iana-time-zone-0.1.53.crate", - "sha256": "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765", - "dest": "cargo/vendor/iana-time-zone-0.1.53" - }, - { - "type": "inline", - "contents": "{\"package\": \"64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765\", \"files\": {}}", - "dest": "cargo/vendor/iana-time-zone-0.1.53", - "dest-filename": ".cargo-checksum.json" - }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/iana-time-zone-haiku/iana-time-zone-haiku-0.1.1.crate", - "sha256": "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca", - "dest": "cargo/vendor/iana-time-zone-haiku-0.1.1" - }, - { - "type": "inline", - "contents": "{\"package\": \"0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca\", \"files\": {}}", - "dest": "cargo/vendor/iana-time-zone-haiku-0.1.1", - "dest-filename": ".cargo-checksum.json" - }, { "type": "archive", "archive-type": "tar-gzip", @@ -2261,19 +2144,6 @@ "dest": "cargo/vendor/libloading-0.7.4", "dest-filename": ".cargo-checksum.json" }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/link-cplusplus/link-cplusplus-1.0.8.crate", - "sha256": "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5", - "dest": "cargo/vendor/link-cplusplus-1.0.8" - }, - { - "type": "inline", - "contents": "{\"package\": \"ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5\", \"files\": {}}", - "dest": "cargo/vendor/link-cplusplus-1.0.8", - "dest-filename": ".cargo-checksum.json" - }, { "type": "archive", "archive-type": "tar-gzip", @@ -3431,19 +3301,6 @@ "dest": "cargo/vendor/scopeguard-1.1.0", "dest-filename": ".cargo-checksum.json" }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/scratch/scratch-1.0.3.crate", - "sha256": "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2", - "dest": "cargo/vendor/scratch-1.0.3" - }, - { - "type": "inline", - "contents": "{\"package\": \"ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2\", \"files\": {}}", - "dest": "cargo/vendor/scratch-1.0.3", - "dest-filename": ".cargo-checksum.json" - }, { "type": "archive", "archive-type": "tar-gzip", @@ -3834,19 +3691,6 @@ "dest": "cargo/vendor/tempfile-3.3.0", "dest-filename": ".cargo-checksum.json" }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/termcolor/termcolor-1.1.3.crate", - "sha256": "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755", - "dest": "cargo/vendor/termcolor-1.1.3" - }, - { - "type": "inline", - "contents": "{\"package\": \"bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755\", \"files\": {}}", - "dest": "cargo/vendor/termcolor-1.1.3", - "dest-filename": ".cargo-checksum.json" - }, { "type": "archive", "archive-type": "tar-gzip", @@ -3915,14 +3759,40 @@ { "type": "archive", "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/time/time-0.1.45.crate", - "sha256": "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a", - "dest": "cargo/vendor/time-0.1.45" + "url": "https://static.crates.io/crates/time/time-0.3.17.crate", + "sha256": "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376", + "dest": "cargo/vendor/time-0.3.17" }, { "type": "inline", - "contents": "{\"package\": \"1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a\", \"files\": {}}", - "dest": "cargo/vendor/time-0.1.45", + "contents": "{\"package\": \"a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376\", \"files\": {}}", + "dest": "cargo/vendor/time-0.3.17", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/time-core/time-core-0.1.0.crate", + "sha256": "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd", + "dest": "cargo/vendor/time-core-0.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd\", \"files\": {}}", + "dest": "cargo/vendor/time-core-0.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/time-macros/time-macros-0.2.6.crate", + "sha256": "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2", + "dest": "cargo/vendor/time-macros-0.2.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2\", \"files\": {}}", + "dest": "cargo/vendor/time-macros-0.2.6", "dest-filename": ".cargo-checksum.json" }, { @@ -4198,19 +4068,6 @@ "dest": "cargo/vendor/unicode-normalization-0.1.22", "dest-filename": ".cargo-checksum.json" }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/unicode-width/unicode-width-0.1.10.crate", - "sha256": "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b", - "dest": "cargo/vendor/unicode-width-0.1.10" - }, - { - "type": "inline", - "contents": "{\"package\": \"c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b\", \"files\": {}}", - "dest": "cargo/vendor/unicode-width-0.1.10", - "dest-filename": ".cargo-checksum.json" - }, { "type": "archive", "archive-type": "tar-gzip", @@ -4328,19 +4185,6 @@ "dest": "cargo/vendor/wasi-0.9.0+wasi-snapshot-preview1", "dest-filename": ".cargo-checksum.json" }, - { - "type": "archive", - "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/wasi/wasi-0.10.0+wasi-snapshot-preview1.crate", - "sha256": "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f", - "dest": "cargo/vendor/wasi-0.10.0+wasi-snapshot-preview1" - }, - { - "type": "inline", - "contents": "{\"package\": \"1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f\", \"files\": {}}", - "dest": "cargo/vendor/wasi-0.10.0+wasi-snapshot-preview1", - "dest-filename": ".cargo-checksum.json" - }, { "type": "archive", "archive-type": "tar-gzip", diff --git a/src/ui/ui_backup.rs b/src/ui/ui_backup.rs index a107720..6a89da8 100644 --- a/src/ui/ui_backup.rs +++ b/src/ui/ui_backup.rs @@ -1,7 +1,7 @@ use std::path::{Path, PathBuf}; -use chrono::Local; use egui::ScrollArea; +use time::format_description; use crate::{ config::get_backups_flder, @@ -100,11 +100,16 @@ pub fn load_backups() -> Vec { result } +const DATE_FORMAT :&str = "[year]-[month]-[day]-[hour]-[minute]-[second]"; + pub fn backup_shortcuts(steam_settings: &SteamSettings) { + use time::OffsetDateTime; + let backup_folder = get_backups_flder(); let paths = get_shortcuts_paths(steam_settings); - let date = Local::now(); - let date_string = date.format("%Y-%m-%d-%H-%M-%S"); + let date = OffsetDateTime::now_utc(); + let format = format_description::parse(DATE_FORMAT).unwrap(); + let date_string = date.format(&format).unwrap(); if let Ok(user_infos) = paths { for user_info in user_infos { if let Some(shortcut_path) = user_info.shortcut_path {