Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix external data loader plugins on Windows #4840

Merged
merged 5 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion crates/re_data_source/src/data_loader/loader_external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,21 @@ pub const EXTERNAL_DATA_LOADER_INCOMPATIBLE_EXIT_CODE: i32 = 66;
pub static EXTERNAL_LOADER_PATHS: Lazy<Vec<std::path::PathBuf>> = Lazy::new(|| {
re_tracing::profile_function!();

let dir_separator = if cfg!(target_os = "windows") {
';'
} else {
':'
};

let dirpaths = std::env::var("PATH")
.ok()
.into_iter()
.flat_map(|paths| paths.split(':').map(ToOwned::to_owned).collect::<Vec<_>>())
.flat_map(|paths| {
paths
.split(dir_separator)
.map(ToOwned::to_owned)
.collect::<Vec<_>>()
})
.map(std::path::PathBuf::from);

let mut executables = HashMap::<String, Vec<std::path::PathBuf>>::default();
Expand Down
6 changes: 5 additions & 1 deletion examples/python/external_data_loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
This is an example executable data-loader plugin for the Rerun Viewer.

It will log Python source code files as markdown documents.
To try it out, copy it in your $PATH as `rerun-loader-python-file`, then open a Python source file with Rerun (`rerun file.py`).

On Linux & Mac you can simply copy it in your $PATH as `rerun-loader-python-file`, then open a Python source file with Rerun (`rerun file.py`).
emilk marked this conversation as resolved.
Show resolved Hide resolved

On Windows you have to install the script as an executable first and then put the executable under %PATH%.
One way to do this is to use `pyinstaller`: `pyinstaller .\examples\python\external_data_loader\main.py -n rerun-loader-python-file --onefile`

Check warning on line 25 in examples/python/external_data_loader/README.md

View workflow job for this annotation

GitHub Actions / Spellcheck

Unknown word (pyinstaller)

Check warning on line 25 in examples/python/external_data_loader/README.md

View workflow job for this annotation

GitHub Actions / Spellcheck

Unknown word (pyinstaller)

Check warning on line 25 in examples/python/external_data_loader/README.md

View workflow job for this annotation

GitHub Actions / Spellcheck

Unknown word (onefile)