Skip to content

Commit 43bc46e

Browse files
committed
Fix errors in APPDATA folder
1 parent 81fdb80 commit 43bc46e

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# See http://www.appveyor.com/docs/appveyor-yml for many more options
2-
version: 0.1.{build}
2+
version: 0.2.{build}
33

44
cache:
55
- C:\ProgramData\chocolatey\bin -> appveyor.yml

functions/clone/New-PSDCClone.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@
154154

155155
# Set the location where to save the diskpart command
156156
$diskpartScriptFile = Get-PSFConfigValue -FullName psdatabaseclone.diskpart.scriptfile -Fallback "$env:APPDATA\psdatabaseclone\diskpartcommand.txt"
157+
158+
if(-not (Test-Path -Path $diskpartScriptFile)){
159+
try{
160+
New-Item -Path $diskpartScriptFile -ItemType File
161+
}
162+
catch{
163+
Stop-PSFFunction -Message "Could not create diskpart script file" -ErrorRecord $_ -Continue
164+
}
165+
}
157166
}
158167

159168
process {

functions/disk/New-PSDCVhdDisk.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@
164164

165165
# Set the location where to save the diskpart command
166166
$diskpartScriptFile = Get-PSFConfigValue -FullName psdatabaseclone.diskpart.scriptfile -Fallback "$env:APPDATA\psdatabaseclone\diskpartcommand.txt"
167+
168+
if(-not (Test-Path -Path $diskpartScriptFile)){
169+
try{
170+
New-Item -Path $diskpartScriptFile -ItemType File
171+
}
172+
catch{
173+
Stop-PSFFunction -Message "Could not create diskpart script file" -ErrorRecord $_ -Continue
174+
}
175+
}
167176
}
168177

169178
process {

functions/support/Set-PSDCConfiguration.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@
390390

391391
# Set the path to the diskpart script file
392392
Set-PSFConfig -Module PSDatabaseClone -Name diskpart.scriptfile -Value "$env:APPDATA\psdatabaseclone\diskpartcommand.txt" -Validation string
393+
New-Item -Path "$env:APPDATA\psdatabaseclone" -ItemType Directory
393394
Get-PSFConfig -FullName psdatabaseclone.diskpart.scriptfile | Register-PSFConfig -Scope SystemDefault
394395

395396
# Check if all the settings have been made

0 commit comments

Comments
 (0)