Skip to content

Commit 5e8a9da

Browse files
committed
Disable messagebox for Appimage
1 parent 828976d commit 5e8a9da

File tree

8 files changed

+121
-116
lines changed

8 files changed

+121
-116
lines changed

Cargo.lock

+89-100
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

alvr/common/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ rust-version.workspace = true
66
authors.workspace = true
77
license.workspace = true
88

9+
[features]
10+
enable-messagebox = ["rfd"]
11+
912
[dependencies]
1013
anyhow = { version = "1", features = ["backtrace"] }
1114
backtrace = "0.3"
@@ -19,4 +22,4 @@ settings-schema = { git = "https://github.com/zarik5/settings-schema-rs" }
1922
# settings-schema = { path = "../../../../settings-schema-rs/settings-schema" }
2023

2124
[target.'cfg(not(target_os = "android"))'.dependencies]
22-
rfd = "0.11"
25+
rfd = {version = "0.11", optional = true }

alvr/common/src/logging.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn set_panic_hook() {
4949

5050
log::error!("{err_str}");
5151

52-
#[cfg(not(target_os = "android"))]
52+
#[cfg(all(not(target_os = "android"), feature = "enable-messagebox"))]
5353
std::thread::spawn(move || {
5454
rfd::MessageDialog::new()
5555
.set_title("ALVR panicked")
@@ -63,7 +63,7 @@ pub fn set_panic_hook() {
6363
pub fn show_w<W: Display + Send + 'static>(w: W) {
6464
log::warn!("{w}");
6565

66-
#[cfg(not(target_os = "android"))]
66+
#[cfg(all(not(target_os = "android"), feature = "enable-messagebox"))]
6767
std::thread::spawn(move || {
6868
rfd::MessageDialog::new()
6969
.set_title("ALVR warning")
@@ -81,7 +81,7 @@ pub fn show_warn<T, E: Display + Send + 'static>(res: Result<T, E>) -> Option<T>
8181
fn show_e_block<E: Display>(e: E, blocking: bool) {
8282
log::error!("{e}");
8383

84-
#[cfg(not(target_os = "android"))]
84+
#[cfg(all(not(target_os = "android"), feature = "enable-messagebox"))]
8585
{
8686
// Store the last error shown in a message box. Do not open a new message box if the content
8787
// of the error has not changed

alvr/launcher/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9+
alvr_common.workspace = true
910
alvr_gui_common.workspace = true
1011

1112
anyhow = "1"

alvr/server/src/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ pub fn create_recording_file() {
117117
"h265"
118118
};
119119

120-
let path = FILESYSTEM_LAYOUT
121-
.log_dir
122-
.join(format!("recording.{}.{ext}", chrono::Local::now().format("%F.%H-%M-%S")));
120+
let path = FILESYSTEM_LAYOUT.log_dir.join(format!(
121+
"recording.{}.{ext}",
122+
chrono::Local::now().format("%F.%H-%M-%S")
123+
));
123124

124125
match File::create(path) {
125126
Ok(mut file) => {

alvr/xtask/src/build.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ impl Display for Profile {
2828

2929
pub fn build_streamer(
3030
profile: Profile,
31+
enable_messagebox: bool,
3132
gpl: bool,
3233
root: Option<String>,
3334
reproducible: bool,
@@ -46,6 +47,10 @@ pub fn build_streamer(
4647
Profile::Release => common_flags.push("--release"),
4748
Profile::Debug => (),
4849
}
50+
if enable_messagebox {
51+
common_flags.push("--features");
52+
common_flags.push("alvr_common/enable-messagebox");
53+
}
4954
if reproducible {
5055
common_flags.push("--locked");
5156
}
@@ -191,7 +196,7 @@ pub fn build_streamer(
191196
}
192197
}
193198

194-
pub fn build_launcher(profile: Profile, reproducible: bool) {
199+
pub fn build_launcher(profile: Profile, enable_messagebox: bool, reproducible: bool) {
195200
let sh = Shell::new().unwrap();
196201

197202
let mut common_flags = vec![];
@@ -203,6 +208,10 @@ pub fn build_launcher(profile: Profile, reproducible: bool) {
203208
Profile::Release => common_flags.push("--release"),
204209
Profile::Debug => (),
205210
}
211+
if enable_messagebox {
212+
common_flags.push("--features");
213+
common_flags.push("alvr_common/enable-messagebox");
214+
}
206215
if reproducible {
207216
common_flags.push("--locked");
208217
}

alvr/xtask/src/main.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -186,24 +186,26 @@ fn main() {
186186
dependencies::build_android_deps(for_ci);
187187
}
188188
}
189-
"build-streamer" => build::build_streamer(profile, gpl, None, false, keep_config),
190-
"build-launcher" => build::build_launcher(profile, false),
189+
"build-streamer" => {
190+
build::build_streamer(profile, true, gpl, None, false, keep_config)
191+
}
192+
"build-launcher" => build::build_launcher(profile, true, false),
191193
"build-client" => build::build_android_client(profile),
192194
"build-client-lib" => build::build_client_lib(profile, link_stdcpp),
193195
"run-streamer" => {
194196
if !no_rebuild {
195-
build::build_streamer(profile, gpl, None, false, keep_config);
197+
build::build_streamer(profile, true, gpl, None, false, keep_config);
196198
}
197199
run_streamer();
198200
}
199201
"run-launcher" => {
200202
if !no_rebuild {
201-
build::build_launcher(profile, false);
203+
build::build_launcher(profile, true, false);
202204
}
203205
run_launcher();
204206
}
205207
"package-streamer" => packaging::package_streamer(gpl, root, appimage, zsync),
206-
"package-launcher" => packaging::package_launcher(),
208+
"package-launcher" => packaging::package_launcher(appimage),
207209
"package-client" => build::build_android_client(Profile::Distribution),
208210
"package-client-lib" => packaging::package_client_lib(link_stdcpp),
209211
"clean" => clean(),

alvr/xtask/src/packaging.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn include_licenses(root_path: &Path, gpl: bool) {
148148
pub fn package_streamer(gpl: bool, root: Option<String>, appimage: bool, zsync: bool) {
149149
let sh = Shell::new().unwrap();
150150

151-
build::build_streamer(Profile::Distribution, gpl, root, true, false);
151+
build::build_streamer(Profile::Distribution, !appimage, gpl, root, true, false);
152152

153153
include_licenses(&afs::streamer_build_dir(), gpl);
154154

@@ -166,10 +166,10 @@ pub fn package_streamer(gpl: bool, root: Option<String>, appimage: bool, zsync:
166166
}
167167
}
168168

169-
pub fn package_launcher() {
169+
pub fn package_launcher(appimage: bool) {
170170
let sh = Shell::new().unwrap();
171171

172-
build::build_launcher(Profile::Distribution, true);
172+
build::build_launcher(Profile::Distribution, !appimage, true);
173173

174174
include_licenses(&afs::launcher_build_dir(), false);
175175

0 commit comments

Comments
 (0)