Build a standalone Windows desktop with opt-in project removal
This commit is contained in:
1 parent
2c5b9b5f10
commit
2c99cade7d
24 files changed
+1404
-168
No files matched your search
@@ -37,6 +37,8 @@ mod resource_capture;
|
||||
mod saved_project;
|
||||
mod text_layer;
|
||||
mod thread_usage;
|
||||
#[cfg(windows)]
|
||||
mod windows_format;
|
||||
|
||||
const MAX_EDIT_BODY: u64 = 2 * 1024 * 1024;
|
||||
const PAGE: &str = include_str!("index.html");
|
||||
@@ -275,6 +277,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
std::process::exit(status);
|
||||
}
|
||||
let mut args = std::env::args_os().skip(1).peekable();
|
||||
#[cfg(windows)]
|
||||
if args.next_if(|arg| arg == "--windows-desktop").is_some() {
|
||||
return windows_format::run(args).map_err(|error| {
|
||||
let detail = error.to_string().replace(['\r', '\n'], " ");
|
||||
println!("Texrra desktop error {detail}");
|
||||
error
|
||||
});
|
||||
}
|
||||
let usage = "native_editor [--input-profile PROFILE] [--web-dir DIR] [--source-root DIR] SOURCE FORMAT FORMAT_RESOURCES NEW_RUN_DIR [PORT] [FILE ...] or native_editor [--input-profile PROFILE] --web-dir DIR --projects STORE FORMAT FORMAT_RESOURCES RUNS [PORT]";
|
||||
let input_profile = if args.next_if(|arg| arg == "--input-profile").is_some() {
|
||||
match args.next().as_deref().and_then(std::ffi::OsStr::to_str) {
|
||||
@@ -337,6 +347,15 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let editor = finish_prepare(staged, &run, &compiler, None, None)?;
|
||||
(port, Some(EditorSession::new(run, editor, compiler, None)))
|
||||
};
|
||||
serve(web, library, port, session)
|
||||
}
|
||||
|
||||
fn serve(
|
||||
web: Option<WebAssets>,
|
||||
library: Option<library::Library>,
|
||||
port: u16,
|
||||
session: Option<EditorSession>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut session = session.map(|session| Arc::new(Mutex::new(session)));
|
||||
let mut opening: Option<OpeningEditor> = None;
|
||||
let server = Server::http(("127.0.0.1", port)).map_err(|e| e.to_string())?;
|
||||
|
||||
Reference in new issue
Block a user