Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a better way to hold a file path than in a string?

Tags:

c#

path

I am making a command line utility. I need to pass around a few file paths in the program.

Right now I am just using string. But I was wondering if the .net library had a cool class for passing around file paths.

like image 653
Vaccano Avatar asked Jul 28 '10 14:07

Vaccano


People also ask

What are the two types of file paths?

File paths specify the location of individual files. They are used to give files access to one another and they are of two types : Absolute and Relative. Relative file paths on the hand points to the location of files in the root folder of an individual web project with reference to the current working file.

What is an absolute file path?

What Is An Absolute Path? An absolute path is defined as the specifying the location of a file or directory from the root directory(/). In other words we can say absolute path is a complete path from start of actual filesystem from / directory.

How do I get Windows 10 to accept file paths over 260 characters?

To enable long file paths in Windows, open Registry Editor, create a new DWORD named "LongPathsEnabled" in "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" and set the value to 1.

What does \\ mean in Windows path?

They indicate that the path should be passed to the system with minimal modification, which means that you cannot use forward slashes to represent path separators, or a period to represent the current directory, or double dots to represent the parent directory.


1 Answers

Well, there's FileInfo - that's about as close as you get.

like image 194
Jon Skeet Avatar answered Sep 28 '22 01:09

Jon Skeet