mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-11 22:50:08 +00:00
print current version in the project manager window's title
This commit is contained in:
@@ -7,7 +7,7 @@ license = "MIT"
|
||||
description = "Project manager for Fyrox engine"
|
||||
keywords = ["fyrox", "project", "manager"]
|
||||
categories = ["game-development"]
|
||||
include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md", "/resources/**/*"]
|
||||
include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md", "/resources/**/*", "/pm.version"]
|
||||
homepage = "https://fyrox.rs"
|
||||
repository = "https://github.com/FyroxEngine/Fyrox"
|
||||
rust-version = "1.87"
|
||||
@@ -21,4 +21,7 @@ ron = "0.11.0"
|
||||
open = "5.0.1"
|
||||
cargo_metadata = "0.22.0"
|
||||
serde_json = "1.0.133"
|
||||
directories = "5.0.1"
|
||||
directories = "5.0.1"
|
||||
|
||||
[build-dependencies]
|
||||
toml_edit = "0.23.5"
|
||||
@@ -0,0 +1,35 @@
|
||||
use std::{
|
||||
fs::File,
|
||||
io::{Read, Write},
|
||||
};
|
||||
use toml_edit::DocumentMut;
|
||||
|
||||
fn write_version_file(manifest_path: &str, version_file: &str) {
|
||||
let mut toml = String::new();
|
||||
File::open(manifest_path)
|
||||
.expect("Cargo.toml must exist!")
|
||||
.read_to_string(&mut toml)
|
||||
.expect("File must be readable");
|
||||
|
||||
let version = toml
|
||||
.parse::<DocumentMut>()
|
||||
.expect("must be valid toml")
|
||||
.get("package")
|
||||
.and_then(|i| i.as_table())
|
||||
.expect("package section must exist!")
|
||||
.get("version")
|
||||
.expect("version must be set!")
|
||||
.to_string()
|
||||
.replace('\"', "")
|
||||
.trim()
|
||||
.to_string();
|
||||
|
||||
File::create(version_file)
|
||||
.expect("version file must be accessible for writing!")
|
||||
.write_all(version.as_bytes())
|
||||
.expect("version file must be writable!");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
write_version_file("./Cargo.toml", "./pm.version");
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
1.0.0
|
||||
@@ -28,6 +28,8 @@ mod settings;
|
||||
mod upgrade;
|
||||
mod utils;
|
||||
|
||||
static CURRENT_VERSION: &str = include_str!("../pm.version");
|
||||
|
||||
use crate::{manager::ProjectManager, settings::DATA_DIR, utils::make_button};
|
||||
use fyrox::core::algebra::Vector2;
|
||||
use fyrox::{
|
||||
@@ -75,7 +77,7 @@ fn main() {
|
||||
let mut window_attributes = WindowAttributes::default();
|
||||
window_attributes.inner_size = Some(PhysicalSize::new(720, 520).into());
|
||||
window_attributes.resizable = true;
|
||||
window_attributes.title = "Fyrox Project Manager".to_string();
|
||||
window_attributes.title = format!("Fyrox Project Manager - {}", CURRENT_VERSION);
|
||||
|
||||
let serialization_context = Arc::new(SerializationContext::new());
|
||||
let task_pool = Arc::new(TaskPool::new());
|
||||
|
||||
Reference in New Issue
Block a user