mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-05-29 22:45:17 -04:00
Fix space as first character in directory name
This commit is contained in:
parent
e40d499b72
commit
18d62273e8
1 changed files with 4 additions and 1 deletions
|
@ -5,6 +5,7 @@ import "strings"
|
|||
func normalizeFilename(filename string) string {
|
||||
var out strings.Builder
|
||||
shouldAppend := true
|
||||
firstChar := true
|
||||
|
||||
for _, c := range filename {
|
||||
switch {
|
||||
|
@ -13,14 +14,16 @@ func normalizeFilename(filename string) string {
|
|||
out.WriteRune('_')
|
||||
shouldAppend = false
|
||||
}
|
||||
firstChar = false
|
||||
case c == ' ':
|
||||
if shouldAppend {
|
||||
if shouldAppend && !firstChar {
|
||||
out.WriteRune(' ')
|
||||
shouldAppend = false
|
||||
}
|
||||
case (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'):
|
||||
out.WriteRune(c)
|
||||
shouldAppend = true
|
||||
firstChar = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue