# File path specifications

This is a discussion on File path specifications within the C# Programming forums, part of the General Programming Boards category; Ok hi all. I'm still working on that launcher/patcher, and I need a bit of heads up in a few ...

1. ## 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:
Code:
relative path to the file|version of the file
the engine loads up both the server resource file and the one that is local to separate dictionaries.

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:
Code:
string(prefix) + file_path_from_resource_tracker_file.
so now I have to decide exactly how to save the path in the file.

It can either be
Code:
"\\path\\to\\file"
or
Code:
"/path/to/file"
(maybe even
Code:
"\path\to\file"
.

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.

2. You can use @ to translate literal strings:
Code:
String path = @ "c:\windows\temp\";
Assuming I have the string class right, I haven't actually used them much, and assuming that's what you are asking.

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.

Quzah.

3. thanks. so I just use \...
That will work on an ftp server as well. Correct?

4. 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

Quzah.

5. 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)

6. Here's another one: C# Key: C# 4.0 Programming

string path = Path.Combine("path", "to", "file");