Skip to content

Commit

Permalink
Trim erroneous trailing dots on directory paths (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvlflame committed Dec 26, 2020
1 parent 7a5d0d2 commit d3bdbdf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Javinizer/Public/Set-JVMovie.ps1
Expand Up @@ -235,6 +235,9 @@ function Set-JVMovie {
}

if ($Force -or $PSCmdlet.ShouldProcess($Path)) {
# Windows directory paths do not allow trailing dots/periods but do not throw an error on creation
$folderPath = $folderPath.TrimEnd('.')

# We do not want to recreate the destination folder if it already exists
try {
if (!(Test-Path -LiteralPath $folderPath) -and (!($Update))) {
Expand Down Expand Up @@ -469,13 +472,13 @@ function Set-JVMovie {
} elseif ([System.Environment]::OSVersion.Platform -eq 'Unix') {
if ($Force) {
try {
mv $Path $filePath --force
Move-Item $Path $filePath --force
} catch {
Move-Item -LiteralPath $Path -Destination $filePath -Force
}
} else {
try {
mv $Path $filePath --no-clobber
Move-Item $Path $filePath --no-clobber
} catch {
Move-Item -LiteralPath $Path -Destination $filePath
}
Expand Down Expand Up @@ -504,13 +507,13 @@ function Set-JVMovie {
} elseif ([System.Environment]::OSVersion.Platform -eq 'Unix') {
if ($Force) {
try {
mv $Path $filePath --force
Move-Item $Path $filePath --force
} catch {
Move-Item -LiteralPath $Path -Destination $filePath -Force
}
} else {
try {
mv $Path $filePath --no-clobber
Move-Item $Path $filePath --no-clobber
} catch {
Move-Item -LiteralPath $Path -Destination $filePath
}
Expand Down

0 comments on commit d3bdbdf

Please sign in to comment.