Skip to content

Commit

Permalink
Remove gui-only deps when building cli
Browse files Browse the repository at this point in the history
It looks like these are only GUI dependencies. I still need to test that
it compiles, but these give unused warnings when compiling with the gui
disabled.
  • Loading branch information
benjamin051000 committed Jan 22, 2025
1 parent daf07bd commit 5b9b789
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ lto = "thin"

[features]
default = ["gui"]
gui = ["dep:tauri", "dep:tauri-plugin-log", "dep:tauri-plugin-shell"]
gui = ["dep:tauri", "dep:tauri-plugin-log", "dep:tauri-plugin-shell", "dep:tokio"]

[build-dependencies]
tauri-build = "2"
Expand Down Expand Up @@ -43,7 +43,7 @@ serde_json = "1.0"
tauri = { version = "2", optional = true }
tauri-plugin-log = { version = "2.2.0", optional = true }
tauri-plugin-shell = { version = "2", optional = true }
tokio = { version = "1.42.0", features = ["full"] }
tokio = { version = "1.42.0", features = ["full"], optional = true }

[target.'cfg(windows)'.dependencies]
windows = { version = "0.59.0", features = ["Win32_System_Console"] }
19 changes: 10 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ mod world_editor;
use args::Args;
use clap::Parser;
use colored::*;
#[cfg(feature = "gui")]
use fastnbt::Value;
#[cfg(feature = "gui")]
use flate2::read::GzDecoder;
#[cfg(feature = "gui")]
use log::{error, LevelFilter};
#[cfg(feature = "gui")]
use rfd::FileDialog;
use std::{
env,
fs::{self, File},
io::{Read, Write},
panic,
path::{Path, PathBuf},
};
#[cfg(feature = "gui")]
use std::path::{Path, PathBuf};
use std::{env, fs, io::Write, panic};
#[cfg(feature = "gui")]
use tauri_plugin_log::{Builder as LogBuilder, Target, TargetKind};
#[cfg(target_os = "windows")]
Expand Down Expand Up @@ -125,8 +125,8 @@ fn main() {

// Write the parsed OSM data to a file for inspection
if args.debug {
let mut output_file: File =
File::create("parsed_osm_data.txt").expect("Failed to create output file");
let mut output_file: fs::File =
fs::File::create("parsed_osm_data.txt").expect("Failed to create output file");
for element in &parsed_elements {
writeln!(
output_file,
Expand Down Expand Up @@ -276,6 +276,7 @@ fn gui_select_world(generate_new: bool) -> Result<String, i32> {
}
}

#[cfg(feature = "gui")]
fn create_new_world(base_path: &Path) -> Result<String, String> {
// Generate a unique world name
let mut counter: i32 = 1;
Expand Down

0 comments on commit 5b9b789

Please sign in to comment.