Skip to content

Commit

Permalink
use NOTION_SANDBOX env var for sandboxing logic in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mikrostew committed Oct 11, 2018
1 parent b25b36b commit e2ffc23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/notion-core/src/path/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ cfg_if! {
// launchscript.exe launchscript_file

fn program_data_root() -> Fallible<PathBuf> {
if let Ok(notion_data) = env::var("NOTION_DATA_ROOT") {
// if this is sandboxed in CI, use the sandboxed ProgramData directory
if env::var("NOTION_SANDBOX").is_ok() {
let notion_data = env::var("NOTION_DATA_ROOT").unwrap();
return Ok(PathBuf::from(notion_data).join("Notion"));
} else {
#[cfg(windows)]
Expand Down Expand Up @@ -170,8 +172,9 @@ pub fn shim_file(toolname: &str) -> Fallible<PathBuf> {
// catalog.toml user_catalog_file

fn local_data_root() -> Fallible<PathBuf> {
// used to sandbox the acceptance test environment
if let Some(home_dir) = env::home_dir() {
// if this is sandboxed in CI, use the sandboxed AppData directory
if env::var("NOTION_SANDBOX").is_ok() {
let home_dir = env::home_dir().unwrap();
return Ok(home_dir.join("AppData").join("Local").join("Notion"));
} else {
#[cfg(windows)]
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/support/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ impl Sandbox {
let mut p = test_support::process::process(program);
p.cwd(self.root())
// sandbox the Notion environment
.env("NOTION_SANDBOX", "true") // used to indicate that Notion is running sandboxed, for directory logic in Windows
.env("HOME", home_dir())
.env("USERPROFILE", home_dir()) // windows
.env("NOTION_HOME", notion_home())
Expand Down

0 comments on commit e2ffc23

Please sign in to comment.