It's a simple string manipulation.
- Replace all slashes with back-slashes.
- Remove the first back-slash.
- Replace the first back-slash with a colon followed by a back-slash.
I can't run this code:
var dirPathWin = name.replace("/", "\")
It doesnt work...
A back-slash is a special character that needs to be escaped, so the correct code to use is:
However, this will only replace the first forward-slash in the string. To replace all of them you should use a Regular Expression, not just a string.