Skip to content

Commit 9ec954f

Browse files
committed
Release 1.226.2025
1 parent 6ddb4a5 commit 9ec954f

16 files changed

Lines changed: 187 additions & 185 deletions

Functions/GenXdev.FileSystem/Expand-Path.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function Expand-Path {
149149

150150
if (($normalizedPath.Length -lt 3) -or ($normalizedPath.Substring(2, 1) -ne [System.IO.Path]::DirectorySeparatorChar)) {
151151

152-
Microsoft.PowerShell.Management\Push-Location $normalizedPath.Substring(0, 2)
152+
Microsoft.PowerShell.Management\Push-Location -LiteralPath $normalizedPath.Substring(0, 2)
153153
try {
154154
$normalizedPath = "$(Microsoft.PowerShell.Management\Get-Location)$([IO.Path]::DirectorySeparatorChar)$($normalizedPath.Substring(2))"
155155
$normalizedPath = [System.IO.Path]::GetFullPath($normalizedPath)
@@ -212,7 +212,7 @@ function Expand-Path {
212212
[System.IO.Path]::Combine($pwd, $normalizedPath))
213213
}
214214
catch {
215-
$normalizedPath = Microsoft.PowerShell.Management\Convert-Path $normalizedPath
215+
$normalizedPath = Microsoft.PowerShell.Management\Convert-Path -LiteralPath $normalizedPath
216216
}
217217
}
218218

Functions/GenXdev.FileSystem/Find-Item.ps1

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ function Find-Item {
952952
else {
953953
# output relative path of the found item
954954
Microsoft.PowerShell.Utility\Write-Information "Resolving relative path with base: $relativeBasePath"
955-
$rp = Microsoft.PowerShell.Management\Resolve-Path -LiteralPath:($itemInfo.FullName) -Relative -RelativeBasePath:$relativeBasePath
955+
$rp = Microsoft.PowerShell.Management\Resolve-Path -LiteralPath: ($itemInfo.FullName) -Relative -RelativeBasePath:$relativeBasePath
956956
Microsoft.PowerShell.Utility\Write-Verbose "Microsoft.PowerShell.Management\Resolve-Path -LiteralPath '$($itemInfo.FullName)' -Relative -RelativeBasePath:'$relativeBasePath'"
957957

958958
Microsoft.PowerShell.Utility\Write-Information "Relative path: $rp"
@@ -1075,63 +1075,63 @@ function Find-Item {
10751075

10761076
Microsoft.PowerShell.Utility\Write-Information "Directory stack processing complete - processed $stackProcessCount items"
10771077
Microsoft.PowerShell.Utility\Write-Verbose "Search complete: Examined $totalDirsProcessed directories and $totalFilesChecked files, found $totalMatches matches"
1078-
}
1078+
}
10791079

1080-
# process each search mask provided
1081-
foreach ($currentSearchPhrase in $using:SearchMask) {
1080+
# process each search mask provided
1081+
foreach ($currentSearchPhrase in $using:SearchMask) {
10821082

1083-
Microsoft.PowerShell.Utility\Write-Information "Processing search pattern: $currentSearchPhrase"
1084-
Microsoft.PowerShell.Utility\Write-Verbose "Processing search pattern: $currentSearchPhrase"
1083+
Microsoft.PowerShell.Utility\Write-Information "Processing search pattern: $currentSearchPhrase"
1084+
Microsoft.PowerShell.Utility\Write-Verbose "Processing search pattern: $currentSearchPhrase"
10851085

1086-
$expandedSearchMask = GenXdev.FileSystem\Expand-Path $currentSearchPhrase
1086+
$expandedSearchMask = GenXdev.FileSystem\Expand-Path $currentSearchPhrase
10871087

1088-
# Check if this specific search mask should include alternate data streams
1089-
# Simplified to only check the expanded search mask
1090-
$hasStreamPattern = $null -ne $streamPatterns[$expandedSearchMask]
1091-
$includeAds = $includeAlternateFileStreams -or $hasStreamPattern
1088+
# Check if this specific search mask should include alternate data streams
1089+
# Simplified to only check the expanded search mask
1090+
$hasStreamPattern = $null -ne $streamPatterns[$expandedSearchMask]
1091+
$includeAds = $includeAlternateFileStreams -or $hasStreamPattern
10921092

1093-
if ($includeAds) {
1094-
Microsoft.PowerShell.Utility\Write-Information "This search mask should include ADS: $currentSearchPhrase"
1095-
}
1093+
if ($includeAds) {
1094+
Microsoft.PowerShell.Utility\Write-Information "This search mask should include ADS: $currentSearchPhrase"
1095+
}
10961096

1097-
# if not a multi-drive search or currently processing root context
1098-
if ($null -eq $PSItem) {
1099-
1100-
Microsoft.PowerShell.Utility\Write-Information 'Searching in current context (not drive-specific)'
1101-
Search-DirectoryContent -SearchPhrase $currentSearchPhrase `
1102-
-IncludeAds $includeAds `
1103-
-HasStreamPattern $hasStreamPattern `
1104-
-ExpandedSearchMask $expandedSearchMask `
1105-
-StreamPatterns $streamPatterns `
1106-
-PassThru $using:PassThru `
1107-
-RelativeBasePath $using:RelativeBasePath `
1108-
-Pattern $using:Pattern `
1109-
-Directory $using:Directory `
1110-
-FilesAndDirectories $using:FilesAndDirectories `
1111-
-NoRecurse $using:NoRecurse
1112-
}
1113-
else {
1114-
$expandedSearchMask = GenXdev.FileSystem\Expand-Path $currentSearchPhrase `
1115-
-ForceDrive $PSItem.Name
1116-
# force the search to start from the specific drive
1117-
Microsoft.PowerShell.Utility\Write-Information "Searching on drive $($PSItem.Name)"
1118-
Microsoft.PowerShell.Utility\Write-Verbose "Searching on drive $($PSItem.Name)"
1119-
Microsoft.PowerShell.Utility\Write-Information "Expanded path for drive $($PSItem.Name): $expandedSearchMask"
1120-
1121-
Search-DirectoryContent -SearchPhrase $expandedSearchMask `
1122-
-IncludeAds $includeAds `
1123-
-HasStreamPattern $hasStreamPattern `
1124-
-ExpandedSearchMask $expandedSearchMask `
1125-
-StreamPatterns $streamPatterns `
1126-
-PassThru $using:PassThru `
1127-
-RelativeBasePath $using:RelativeBasePath `
1128-
-Pattern $using:Pattern `
1129-
-Directory $using:Directory `
1130-
-FilesAndDirectories $using:FilesAndDirectories `
1131-
-NoRecurse $using:NoRecurse
1132-
}
1097+
# if not a multi-drive search or currently processing root context
1098+
if ($null -eq $PSItem) {
1099+
1100+
Microsoft.PowerShell.Utility\Write-Information 'Searching in current context (not drive-specific)'
1101+
Search-DirectoryContent -SearchPhrase $currentSearchPhrase `
1102+
-IncludeAds $includeAds `
1103+
-HasStreamPattern $hasStreamPattern `
1104+
-ExpandedSearchMask $expandedSearchMask `
1105+
-StreamPatterns $streamPatterns `
1106+
-PassThru $using:PassThru `
1107+
-RelativeBasePath $using:RelativeBasePath `
1108+
-Pattern $using:Pattern `
1109+
-Directory $using:Directory `
1110+
-FilesAndDirectories $using:FilesAndDirectories `
1111+
-NoRecurse $using:NoRecurse
1112+
}
1113+
else {
1114+
$expandedSearchMask = GenXdev.FileSystem\Expand-Path $currentSearchPhrase `
1115+
-ForceDrive $PSItem.Name
1116+
# force the search to start from the specific drive
1117+
Microsoft.PowerShell.Utility\Write-Information "Searching on drive $($PSItem.Name)"
1118+
Microsoft.PowerShell.Utility\Write-Verbose "Searching on drive $($PSItem.Name)"
1119+
Microsoft.PowerShell.Utility\Write-Information "Expanded path for drive $($PSItem.Name): $expandedSearchMask"
1120+
1121+
Search-DirectoryContent -SearchPhrase $expandedSearchMask `
1122+
-IncludeAds $includeAds `
1123+
-HasStreamPattern $hasStreamPattern `
1124+
-ExpandedSearchMask $expandedSearchMask `
1125+
-StreamPatterns $streamPatterns `
1126+
-PassThru $using:PassThru `
1127+
-RelativeBasePath $using:RelativeBasePath `
1128+
-Pattern $using:Pattern `
1129+
-Directory $using:Directory `
1130+
-FilesAndDirectories $using:FilesAndDirectories `
1131+
-NoRecurse $using:NoRecurse
11331132
}
11341133
}
1134+
}
11351135

11361136
Microsoft.PowerShell.Utility\Write-Information 'PROCESS Find-Item: Search processing completed'
11371137
Microsoft.PowerShell.Utility\Write-Verbose 'Search completed'

Functions/GenXdev.FileSystem/Invoke-Fasti.ps1

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,45 @@ Requires 7-Zip installation (will attempt auto-install via winget if missing).
2222
function Invoke-Fasti {
2323

2424
[CmdletBinding()]
25-
[Alias('fasti')]
25+
[Alias("fasti")]
2626
param(
2727
[Parameter(
2828
Mandatory = $false,
29-
HelpMessage = 'Enter the password for the encrypted archive(s)'
29+
HelpMessage = "Enter the password for the encrypted archive(s)"
3030
)]
3131
[string] $Password
3232
)
3333

3434
begin {
3535

3636
# list of supported archive extensions
37-
$extensions = @('*.7z', '*.7z.001', '*.xz', '*.bzip2', '*.gzip', '*.tar', '*.zip', '*.zip.001',
38-
'*.wim', '*.ar', '*.arj', '*.cab', '*.chm', '*.cpio', '*.cramfs',
39-
'*.dmg', '*.ext', '*.fat', '*.gpt', '*.hfs', '*.ihex', '*.iso',
40-
'*.lzh', '*.lzma', '*.mbr', '*.msi', '*.nsis', '*.ntfs', '*.qcow2',
41-
'*.rar', '*.rpm', '*.squashfs', '*.udf', '*.uefi', '*.vdi', '*.vhd',
42-
'*.vmdk', '*.wim', '*.xar', '*.z')
37+
$extensions = @("*.7z", "*.7z.001", "*.xz", "*.bzip2", "*.gzip", "*.tar", "*.zip", "*.zip.001",
38+
"*.wim", "*.ar", "*.arj", "*.cab", "*.chm", "*.cpio", "*.cramfs",
39+
"*.dmg", "*.ext", "*.fat", "*.gpt", "*.hfs", "*.ihex", "*.iso",
40+
"*.lzh", "*.lzma", "*.mbr", "*.msi", "*.nsis", "*.ntfs", "*.qcow2",
41+
"*.rar", "*.rpm", "*.squashfs", "*.udf", "*.uefi", "*.vdi", "*.vhd",
42+
"*.vmdk", "*.wim", "*.xar", "*.z")
4343
}
4444

4545

4646
process {
4747

4848
# process each archive file found in current directory
49-
Microsoft.PowerShell.Management\Get-ChildItem $extensions -File -ErrorAction SilentlyContinue |
49+
Microsoft.PowerShell.Management\Get-ChildItem -LiteralPath .\ -Filter $extensions -File -ErrorAction SilentlyContinue |
5050
Microsoft.PowerShell.Core\ForEach-Object {
5151

5252
Microsoft.PowerShell.Utility\Write-Verbose "Processing archive: $($PSItem.Name)"
5353

5454
# initialize 7zip executable path
55-
$sevenZip = '7z'
55+
$sevenZip = "7z"
5656

5757
# get archive details
5858
$zipFile = $PSItem.fullname
5959
$name = [system.IO.Path]::GetFileNameWithoutExtension($zipFile)
6060
$path = [System.IO.Path]::GetDirectoryName($zipFile)
6161
$extractPath = [system.Io.Path]::Combine($path, $name)
6262

63-
# create extraction directory if it doesn't exist
63+
# create extraction directory if it doesn"t exist
6464
if ([System.IO.Directory]::exists($extractPath) -eq $false) {
6565

6666
Microsoft.PowerShell.Utility\Write-Verbose "Creating directory: $extractPath"
@@ -76,22 +76,22 @@ function Invoke-Fasti {
7676

7777
if ((Microsoft.PowerShell.Core\Get-Command winget -ErrorAction SilentlyContinue).Length -eq 0) {
7878

79-
throw 'You need to install 7zip or winget first'
79+
throw "You need to install 7zip or winget first"
8080
}
8181

82-
Microsoft.PowerShell.Utility\Write-Verbose 'Installing 7-Zip via winget...'
82+
Microsoft.PowerShell.Utility\Write-Verbose "Installing 7-Zip via winget..."
8383
winget install 7zip
8484

8585
if (![IO.File]::Exists($sevenZip)) {
8686

87-
throw 'You need to install 7-zip'
87+
throw "You need to install 7-zip"
8888
}
8989
}
9090
}
9191

9292
# extract archive contents
9393
Microsoft.PowerShell.Utility\Write-Verbose "Extracting to: $extractPath"
94-
$pwparam = if ($Password) { "-p$Password" } else { '' }
94+
$pwparam = if ($Password) { "-p$Password" } else { "" }
9595
if ([string]::IsNullOrWhiteSpace($Password)) {
9696

9797
& $sevenZip x -y "-o$extractPath" $zipFile
@@ -106,10 +106,10 @@ function Invoke-Fasti {
106106

107107
try {
108108
Microsoft.PowerShell.Utility\Write-Verbose "Removing original archive: $zipFile"
109-
Microsoft.PowerShell.Management\Remove-Item "$zipFile" -Force -ErrorAction silentlycontinue
109+
Microsoft.PowerShell.Management\Remove-Item -LiteralPath "$zipFile" -Force -ErrorAction silentlycontinue
110110
}
111111
catch {
112-
Microsoft.PowerShell.Utility\Write-Verbose 'Failed to remove original archive'
112+
Microsoft.PowerShell.Utility\Write-Verbose "Failed to remove original archive"
113113
}
114114
}
115115
}

Functions/GenXdev.FileSystem/Remove-ItemWithFallback.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function Remove-ItemWithFallback {
135135

136136
if ($null -ne $providerInfo -and $providerInfo.Name -eq 'FileSystem') {
137137
# last resort - mark for deletion on next boot
138-
if (GenXdev.FileSystem\Remove-OnReboot -Path $Path) {
138+
if (GenXdev.FileSystem\Remove-OnRebootn$Path) {
139139
Microsoft.PowerShell.Utility\Write-Verbose "Marked for deletion on next reboot: $Path"
140140
return [bool]$CountRebootDeletionAsSuccess
141141
}

Functions/GenXdev.FileSystem/Remove-OnReboot.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ function Remove-OnReboot {
5454

5555
# get existing pending renames or initialize empty array
5656
try {
57-
$pendingRenames = @(Microsoft.PowerShell.Management\Get-ItemProperty -Path $regKey `
57+
$pendingRenames = @(Microsoft.PowerShell.Management\Get-ItemProperty `
58+
-Path $regKey `
5859
-Name $regName -ErrorAction SilentlyContinue).$regName
5960
}
6061
catch {
@@ -91,7 +92,7 @@ function Remove-OnReboot {
9192
$newPath = [System.IO.Path]::Combine($dir, $newName)
9293

9394
# rename and hide the file
94-
Microsoft.PowerShell.Management\Rename-Item -Path $fullPath -NewName $newName -Force `
95+
Microsoft.PowerShell.Management\Rename-Item -LiteralPath $fullPath -NewName $newName -Force `
9596
-ErrorAction Stop
9697
$file = Microsoft.PowerShell.Management\Get-Item -LiteralPath $newPath -Force
9798
$file.Attributes = $file.Attributes -bor `

Functions/GenXdev.FileSystem/Rename-InProject.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ function Rename-InProject {
242242
}
243243

244244
# process directories in reverse order
245-
Microsoft.PowerShell.Management\Get-ChildItem -Path $sourcePath -Directory -Recurse |
245+
Microsoft.PowerShell.Management\Get-ChildItem -LiteralPath $sourcePath -Directory -Recurse |
246246
Microsoft.PowerShell.Utility\Sort-Object -Descending |
247247
Microsoft.PowerShell.Core\Where-Object {
248248
$_.FullName -notlike '*\.git\*' -and

GenXdev.FileSystem.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: genXdev
55
#
6-
# Generated on: 30/07/2025
6+
# Generated on: 02/08/2025
77
#
88

99
@{
@@ -12,7 +12,7 @@
1212
RootModule = 'GenXdev.FileSystem.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.224.2025'
15+
ModuleVersion = '1.226.2025'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = 'Core'

0 commit comments

Comments
 (0)