Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

feat: open a GUI project with --project on launch

Gilberto45c061f5a10c
diff --git a/README.md b/README.md
index f07ae89d..50b50eec 100644
--- a/README.md
+++ b/README.md
@@ -106,6 +106,17 @@ Download it, open it, drop footage in, cut. No account, no setup.
**Reporting something:** every run writes a log, and Settings › About has the button that opens it along with the one that copies your system information. Attach both to an [issue](https://github.com/jub0t/Concat/issues) and the report arrives with everything it needs. The last ten runs are kept, so yesterday's is still there; nothing is ever sent anywhere on its own.
+### Open a project from the command line
+
+The `concat --project <PROJECT_DIRECTORY>` option opens a project in a new GUI instance. Running `concat` with no arguments keeps the usual startup behaviour.
+
+```sh
+concat --project ./projects/my-cut
+concat --project "C:\Projects\My Cut"
+```
+
+Use an absolute path or a path relative to the current working directory, and quote paths that contain spaces. Pass the project folder, not the JSON file: it must contain `concat.json` or the legacy `wolfcut.json`. This launches a new instance; it does not control an already running GUI. If the project cannot be opened, the new GUI shows its normal project-open error.
+
## How to Contribute
> [!IMPORTANT]
diff --git a/src/crates/concat/src/launch.rs b/src/crates/concat/src/launch.rs
new file mode 100644
index 00000000..9bcb8766
--- /dev/null
+++ b/src/crates/concat/src/launch.rs
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors
+
+//! Desktop launch arguments, kept separate from the window and engine.
+
+use std::ffi::OsString;
+use std::path::PathBuf;
+
+/// No arguments preserves the launch screen; a project names its directory.
+pub fn project(args: impl IntoIterator<Item = OsString>) -> Result<Option<PathBuf>, String> {
+ let mut args = args.into_iter();
+ let Some(option) = args.next() else {
+ return Ok(None);
+ };
+ if option != "--project" {
+ return Err("usage: concat [--project <PROJECT_DIRECTORY>]".into());
+ }
+ let path = args
+ .next()
+ .filter(|path| !path.is_empty() && path != "--project")
+ .ok_or_else(|| "--project requires a project directory".to_string())?;
+ if args.next().is_some() {
+ return Err("usage: concat [--project <PROJECT_DIRECTORY>]".into());
+ }
+ Ok(Some(PathBuf::from(path)))
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn parse(args: &[&str]) -> Result<Option<PathBuf>, String> {
+ project(args.iter().map(|arg| OsString::from(*arg)))
+ }
+
+ #[test]
+ fn no_arguments_keeps_the_launch_screen() {
+ assert_eq!(parse(&[]).unwrap(), None);
+ }
+
+ #[test]
+ fn accepts_a_directory_with_spaces_and_unicode() {
+ assert_eq!(
+ parse(&["--project", "podcasts/Café com amigos"]).unwrap(),
+ Some(PathBuf::from("podcasts/Café com amigos"))
+ );
+ }
+
+ #[test]
+ fn rejects_missing_empty_duplicate_and_unknown_arguments() {
+ for args in [
+ vec!["--project"],
+ vec!["--project", ""],
+ vec!["--project", "--project"],
+ vec!["--project", "one", "--project", "two"],
+ vec!["--unknown"],
+ vec!["one"],
+ ] {
+ assert!(parse(&args).is_err(), "{args:?}");
+ }
+ }
+
+ #[cfg(unix)]
+ #[test]
+ fn preserves_non_unicode_paths_for_the_open_error_handler() {
+ use std::os::unix::ffi::OsStringExt;
+ let path = OsString::from_vec(vec![b'/', 0xff]);
+ assert_eq!(
+ project([OsString::from("--project"), path.clone()]).unwrap(),
+ Some(PathBuf::from(path))
+ );
+ }
+}
diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rs
index 6ee538ed..e1c172e1 100644
--- a/src/crates/concat/src/lib.rs
+++ b/src/crates/concat/src/lib.rs
@@ -131,6 +131,15 @@ pub fn report_startup_failure(error: &slint::PlatformError) {
/// Builds the window, binds it to the engine, and runs it until it closes.
pub fn run() -> Result<(), slint::PlatformError> {
+ run_with_project(None)
+}
+
+/// Builds the window and opens a project directory before its first frame.
+///
+/// Relative paths are resolved against the launcher's working directory. An
+/// unreadable project leaves the launch screen open with the usual error notice.
+/// Each invocation creates its own window; this does not control another instance.
+pub fn run_with_project(project: Option<std::path::PathBuf>) -> Result<(), slint::PlatformError> {
// The shell doesn't exist yet - it needs the window the backend is about
// to help create - but `Shell::with` is a no-op until `Shell::install`
// runs, and by the time an OS drop can actually happen, it has. Import
@@ -1830,6 +1839,26 @@ pub fn run() -> Result<(), slint::PlatformError> {
}
});
+ if let Some(path) = project {
+ // Use the same loader as Open project, after all callbacks and models
+ // are installed. Make the path absolute so recents never depend on the
+ // launcher's working directory on a later run. Unlike canonicalize,
+ // this does not introduce Windows verbatim paths into media tooling.
+ let opened = std::path::absolute(&path)
+ .map_err(|error| format!("{}: {error}", path.display()))
+ .and_then(|path| {
+ let path = path
+ .to_str()
+ .ok_or_else(|| "project directory is not valid Unicode".to_string())?;
+ concat_host::projects::open(path)
+ })
+ .and_then(|info| shell.studio.borrow_mut().open_project(info));
+ if let Err(error) = opened {
+ log::error!("could not open launch project: {error}");
+ shell.studio.borrow_mut().notify(&error, true);
+ }
+ }
+
{
shell.studio.borrow_mut().refresh_art();
shell.studio.borrow().publish(&app, &shell.models);
diff --git a/src/crates/concat/src/main.rs b/src/crates/concat/src/main.rs
index a178edca..c98bee25 100644
--- a/src/crates/concat/src/main.rs
+++ b/src/crates/concat/src/main.rs
@@ -7,6 +7,8 @@
// Hide the console window on Windows in release builds.
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
+mod launch;
+
fn main() -> Result<(), slint::PlatformError> {
// A desktop's console is its standard error, which a packaged build
// has wired to nowhere; hence the file underneath it.
@@ -14,5 +16,8 @@ fn main() -> Result<(), slint::PlatformError> {
// A failure here is the one this binary would otherwise swallow: with
// no console, the runtime's "Error: ..." on standard error is lost.
// https://github.com/jub0t/Concat/issues/135
- concat::run().inspect_err(concat::report_startup_failure)
+ let project = launch::project(std::env::args_os().skip(1))
+ .map_err(slint::PlatformError::Other)
+ .inspect_err(concat::report_startup_failure)?;
+ concat::run_with_project(project).inspect_err(concat::report_startup_failure)
}