Skip to content

Commit 41a2131

Browse files
committed
Fiddling with paths
1 parent 4c66ca0 commit 41a2131

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

Main.ps1

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,22 @@ Write-TimedMessage "Minimizing Administrator window" -StartNewStep
8686
Minimize-Window "Administrator: C:\actions"
8787
Write-TimedMessage "Window minimized"
8888

89-
89+
$originalSrcDir = $srcDir
9090

9191
foreach ($folder in $folders) {
92+
Write-Host "========================="
93+
# Reset the source directory to the original value
94+
$srcDir = $originalSrcDir
95+
9296
Write-TimedMessage "Processing folder: $folder" -StartNewStep
9397
$fileExtension = $folder.Substring($folder.LastIndexOf('.') + 1)
98+
Write-Host "File extension: $fileExtension"
9499
$app = Get-OfficeApp -FileExtension $fileExtension
95100

96101
$ext = ""
97102
if ($app -ne "Access") {
98103
$ext = "zip"
99-
Write-TimedMessage "Creating Zip file and renaming to Office document target" -StartNewStep
104+
Write-TimedMessage "Creating Zip file and renaming to Office document target with path ${srcDir}${folder}" -StartNewStep
100105
. "$PSScriptRoot/scripts/Zip-It.ps1" "${srcDir}${folder}"
101106
Write-TimedMessage "Zip file created"
102107
}
@@ -116,6 +121,8 @@ foreach ($folder in $folders) {
116121
$buildVbaScriptPath = "$PSScriptRoot/scripts/Build-VBA.ps1"
117122
$success = Invoke-ScriptWithTimeout -ScriptPath $buildVbaScriptPath -Arguments @("${srcDir}${folder}", "$app") -TimeoutSeconds 30
118123

124+
Write-Host "srcDir: ${srcDir}"
125+
119126
if (-not $success) {
120127
Write-TimedMessage "🔴 Build-VBA.ps1 execution timed out or failed for ${folder}. Continuing with next file..."
121128

@@ -129,5 +136,4 @@ foreach ($folder in $folders) {
129136
}
130137

131138
Write-TimedMessage "🟢 Completed processing folder: $folder"
132-
Write-Host "========================="
133139
}

scripts/Rename-It.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ $fileExtension = $fileName.Substring($fileName.LastIndexOf('.') + 1)
2929

3030
# Create a copy of the zip/document file in the $folderName/Skeleton folder at the top level
3131
$copySource = "$folderName/Skeleton/$fileNameNoExt.$ext"
32-
$renameDestinationFolder = "$rootSrcDir/out"
33-
$renameDestinationFilePath = "$renameDestinationFolder/$fileNameNoExt.$fileExtension"
32+
$renameDestinationFolder = $rootSrcDir + "out/"
33+
$renameDestinationFilePath = "$renameDestinationFolder$fileNameNoExt.$fileExtension"
3434

3535
# Create rename destination folder if it doesn't exist
3636
if (-not (Test-Path $renameDestinationFolder)) {

scripts/Zip-It.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
# This script uses 7-Zip to compress files and directory in the ${docDirPath}/XMLsource directory into a zip file.
22

33

4-
$docDirPath = $args[0]
4+
$dirPath = $args[0]
55
if (-not $docDirPath) {
6-
Write-Host "Error: No docDirPath specified. Usage: Zip-It.ps1 <docDirPath>"
6+
Write-Host "Error: No dirPath specified. Usage: Zip-It.ps1 <dirPath>"
77
exit 1
88
}
9+
Write-Host "dirPath: $dirPath"
10+
11+
# Import utility functions
12+
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
13+
. "$scriptPath/utils/Path.ps1"
914

1015
$currentDir = (Get-Location).Path + "/"
1116
Write-Host "Current directory: $currentDir"
12-
$docDirPath = GetAbsPath -path $docDirPath -basePath $currentDir
17+
$docDirPath = GetAbsPath -path $dirPath -basePath $currentDir
1318
Write-Host "Using docDirPath: $docDirPath"
1419

1520
$docDirPath = NormalizeDirPath $docDirPath

0 commit comments

Comments
 (0)