-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Join-Path/With-path-separator, close #20
- Loading branch information
1 parent
4f60067
commit 796cbbb
Showing
8 changed files
with
53 additions
and
17 deletions.
There are no files selected for viewing
File renamed without changes.
32 changes: 16 additions & 16 deletions
32
Cmdlets/Join-Path/README.md → .../Join-Path/Drive-does-not-exist/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# `Join-Path` fails if the path drive does not exist | ||
|
||
The script [Test-missing-drive.ps1](Test-missing-drive.ps1) finds a missing drive and uses it in order | ||
to join paths by the .NET method `Path.Combine()` (works) and by PowerShell | ||
cmdlet `Join-Path` (fails). | ||
|
||
### Join-Path with UNC paths: mind the current provider | ||
|
||
When `Join-Path` is used with UNC paths then the results may depend on the | ||
current provider. If it is accidentally not *FileSystem* then it may be a | ||
mistake. The script [Test-mind-the-provider.ps1](Test-mind-the-provider.ps1) shows the issue. | ||
|
||
--- | ||
|
||
- [Split-Path](../Split-Path) | ||
- Microsoft Connect 779068 | ||
# `Join-Path` fails if the path drive does not exist | ||
|
||
The script [Test-missing-drive.ps1](Test-missing-drive.ps1) finds a missing drive and uses it in order | ||
to join paths by the .NET method `Path.Combine()` (works) and by PowerShell | ||
cmdlet `Join-Path` (fails). | ||
|
||
### Join-Path with UNC paths: mind the current provider | ||
|
||
When `Join-Path` is used with UNC paths then the results may depend on the | ||
current provider. If it is accidentally not *FileSystem* then it may be a | ||
mistake. The script [Test-mind-the-provider.ps1](Test-mind-the-provider.ps1) shows the issue. | ||
|
||
--- | ||
|
||
- [Split-Path](../../Split-Path) | ||
- Microsoft Connect 779068 |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
task test { | ||
$1, $2 = ./Test-1.ps1 | ||
if ($PSEdition -eq 'Desktop') { | ||
equals $1 C:\Test\Test\ | ||
equals $2 Test\Test\ | ||
} | ||
else { | ||
equals $1 C:/Test/Test/\ | ||
equals $2 Test/Test/\ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# `Join-Path` with path separator | ||
|
||
Use case: some applications require trailing path separators for input directory paths. | ||
|
||
`Join-Path` with `\` or `/` as the second argument may be used in order to | ||
ensure this requirement in Windows PowerShell. In PowerShell Core results | ||
may be unexpected. | ||
|
||
The script [Test-1.ps1](Test-1.ps1) shows some cases with differences. | ||
|
||
--- | ||
|
||
- [PowerShell/issues/24193](https://github.com/PowerShell/PowerShell/issues/24193) | ||
- [PowerShellTraps/issues/20](https://github.com/nightroman/PowerShellTraps/issues/20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
# 5.1 : C:\Test\Test\ | ||
# 7.x : C:/Test/Test/\ | ||
Join-Path 'C:/Test/Test/' '\' | ||
|
||
# 5.1 : Test\Test\ | ||
# 7.x : Test/Test/\ | ||
Join-Path 'Test/Test/' '/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters