Skip to content

Commit

Permalink
feedback 1_5
Browse files Browse the repository at this point in the history
  • Loading branch information
anmenaga committed Oct 24, 2024
1 parent 49131c5 commit 1d5d25b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions dsc/tests/dsc_settings.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Describe 'tests for dsc settings' {
BeforeAll {

$script:policyFilePath = if ($IsWindows) {
Join-Path $env:ProgramData "dsc" "settings.dsc.json"
Join-Path $env:ProgramData "dsc" "dsc.settings.json"
} else {
"/etc/dsc/settings.dsc.json"
}

$script:dscHome = (Get-Command dsc).Path | Split-Path
$script:dscSettingsFilePath = Join-Path $script:dscHome "settings.dsc.json"
$script:dscSettingsFilePath = Join-Path $script:dscHome "dsc.settings.json"
$script:dscDefaultv1SettingsFilePath = Join-Path $script:dscHome "default_settings.v1.dsc.json"
$script:dscDefaultv1SettingsJson = Get-Content -Raw -Path $script:dscDefaultv1SettingsFilePath

Expand Down
10 changes: 5 additions & 5 deletions dsc_lib/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn parse_input_to_json(value: &str) -> Result<String, DscError> {
/// Will return `Err` if could not find requested setting.
pub fn get_setting(value_name: &str) -> Result<DscSettingValue, DscError> {

const SETTINGS_FILE_NAME: &str = "settings.dsc.json";
const SETTINGS_FILE_NAME: &str = "dsc.settings.json";
// Note that default settings file name has a version that is specific to this version of dsc
const DEFAULT_SETTINGS_FILE_NAME: &str = "default_settings.v1.dsc.json";

Expand Down Expand Up @@ -140,16 +140,16 @@ fn load_value_from_json(path: &PathBuf, value_name: &str) -> Result<serde_json::
#[cfg(target_os = "windows")]
fn get_settings_policy_file_path() -> String
{
// $env:ProgramData+"\dsc\settings.dsc.json"
// $env:ProgramData+"\dsc\dsc.settings.json"
// This location is writable only by admins, but readable by all users
let Ok(local_program_data_path) = std::env::var("ProgramData") else { return String::new(); };
Path::new(&local_program_data_path).join("dsc").join("settings.dsc.json").display().to_string()
Path::new(&local_program_data_path).join("dsc").join("dsc.settings.json").display().to_string()
}

#[cfg(not(target_os = "windows"))]
fn get_settings_policy_file_path() -> String
{
// "/etc/dsc/settings.dsc.json"
// "/etc/dsc/dsc.settings.json"
// This location is writable only by admins, but readable by all users
Path::new("/etc").join("dsc").join("settings.dsc.json").display().to_string()
Path::new("/etc").join("dsc").join("dsc.settings.json").display().to_string()
}

0 comments on commit 1d5d25b

Please sign in to comment.