Problem
i am not fully satisfied with how the safepath function works
solution
optimally i would like to have a way to make a safepath that does what i had with beets:
replace: {
# remove invisible characters like null and control codes
'[\x00-\x1f]': "",
# remove spaces at the beginning and end
\s+$: "",
^\s+: "",
# replace path separator with similar looking unicode
/: "⧸",
# replace dot at the beginning with similar looking unicode
^\.: "․",
}
alternatively i would like to have:
- separate
safepath and ASCIIization
- a
safepath that doesn't care about Microsoft Windows
ideas for implementation
idea1:
- keep the current
safepath as is for backwards compat
- make new functions
safepathUnix safepathWindows and asciiize or normalizeUnicode that implement the alternative solution
idea2:
- a
replace function with regular expressions
idea3:
- a config option that customizes what
safepath does
If you want, I could try to implement idea1, idea2 or something similar.
While i have never worked with go, looking at the code it seems pretty easy with the existing code as guidance.
Problem
i am not fully satisfied with how the
safepathfunction workssolution
optimally i would like to have a way to make a safepath that does what i had with beets:
alternatively i would like to have:
safepathandASCIIizationsafepaththat doesn't care about Microsoft Windowsideas for implementation
idea1:
safepathas is for backwards compatsafepathUnixsafepathWindowsandasciiizeornormalizeUnicodethat implement the alternative solutionidea2:
replacefunction with regular expressionsidea3:
safepathdoesIf you want, I could try to implement idea1, idea2 or something similar.
While i have never worked with go, looking at the code it seems pretty easy with the existing code as guidance.