-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a Rust binary to expose Ribasim CLI
- libribasim and ribasim_cli can share the same libraries - we get `ribasim.exe` instead of `ribasim.cmd`
- Loading branch information
1 parent
d861737
commit 0182ae0
Showing
6 changed files
with
297 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "ribasim" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::env; | ||
|
||
fn main() { | ||
// Get the path to the directory containing the current executable | ||
let exe_dir = env::current_exe().unwrap().parent().unwrap().to_owned(); | ||
|
||
// Set the appropriate environment variable for the current platform | ||
if std::env::consts::OS == "windows" { | ||
env::set_var( | ||
"PATH", | ||
format!( | ||
"{};{}", | ||
exe_dir.join("bin").display(), | ||
env::var("PATH").unwrap_or_default() | ||
), | ||
); | ||
} | ||
|
||
// TODO: Do I need to set LD_LIBRARY_PATH on linux? | ||
|
||
// Get the command line arguments | ||
let args: Vec<String> = std::env::args().skip(1).collect(); | ||
|
||
// Parse command line arguments | ||
todo!(); | ||
|
||
// Call ribasim shared library and check for errors | ||
todo!() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.