C
C#•9mo ago
bl4ck

Path.Combine says "Illegal character in path"

This is the path. Why is it illegal? C:\Users\itsbl\AppData\LocalLow\bl4ckdev x XDev\Airborne\Levels\Untitled (143).level
7 Replies
Mayor McCheese
Mayor McCheese•9mo ago
Are you @ing the string?
bl4ck
bl4ckOP•9mo ago
well there isn't anything to @ since it's like this
Path.Combine(Application.persistentDataPath, "Levels", dddwetgergtrt)
Path.Combine(Application.persistentDataPath, "Levels", dddwetgergtrt)
Mayor McCheese
Mayor McCheese•9mo ago
Ah I don't see anything illegal, can you show more code?
bl4ck
bl4ckOP•9mo ago
Well, this is pretty much the code that throws the error, every file-related operation does it as well
if (!File.Exists(Path.Combine(openedCampaignFolder, dddwetgergtrt)))
{
File.Copy(Path.Combine(Application.persistentDataPath, "Levels", dddwetgergtrt),
Path.Combine(openedCampaignFolder, dddwetgergtrt)); //C:\Users\itsbl\AppData\Local\Temp\w8k55zzl.702\Untitled (143).level
}
if (!File.Exists(Path.Combine(openedCampaignFolder, dddwetgergtrt)))
{
File.Copy(Path.Combine(Application.persistentDataPath, "Levels", dddwetgergtrt),
Path.Combine(openedCampaignFolder, dddwetgergtrt)); //C:\Users\itsbl\AppData\Local\Temp\w8k55zzl.702\Untitled (143).level
}
Mayor McCheese
Mayor McCheese•9mo ago
Path.GetInvalidPathChars Method (System.IO)
Gets an array containing the characters that are not allowed in path names.
bl4ck
bl4ckOP•9mo ago
Nevermind, got it it was a newline 😶
Mayor McCheese
Mayor McCheese•9mo ago
You can always validate the path characters using the method above
Want results from more Discord servers?
Add your server