File path specifications
Ok hi all.
I'm still working on that launcher/patcher, and I need a bit of heads up in a few formatting things.
So the question is: between web and local paths... Does using '/' or '\\' matter?
Now a bit of explanation.
In my resource file, I have a bunch of lines with this kind of formatting:
the engine loads up both the server resource file and the one that is local to separate dictionaries.
relative path to the file|version of the file
Then engine then compares the 2, deletes all local files that are not mentioned in the server, then downloads every file from the server that has a larger version.
Notice that both paths are in this form:
so now I have to decide exactly how to save the path in the file.
string(prefix) + file_path_from_resource_tracker_file.
It can either be or (maybe even .
So my question is which way would work for both a target computer relative path (absolute, prefixed with Directory.GetCurrentDirectory()) (C:\\ etc) AND an FTP server.
You can use @ to translate literal strings:
Assuming I have the string class right, I haven't actually used them much, and assuming that's what you are asking.
String path = @ "c:\windows\temp\";
That way you can enter the path as it would look in Explorer or whatever you are using to look at the path, and it will properly escape it for you.
thanks. so I just use \...
That will work on an ftp server as well. Correct?
Anything that would take a properly formatted string. Basically the @ does all the proper escaping for you. Read here: C# Station: C# Tutorial Lesson 02 - Operators, Types, and Variables
Ah, seem to have missed that when looking for C# resources! Thanks for the link. (I've been missing the learncpp.com style tutorials XD)
Here's another one: C# Key: C# 4.0 Programming
Most of the links in the C# links thread are old and broken now.
If in doubt, use Path.Combine.
string path = Path.Combine("path", "to", "file");