Max Schmeling
Max Schmeling

Reputation: 12509

What is the correct term for referring to a path and filename?

I want to use the correct term to make my API as intuitive as possible, so when a parameter is expected to be a full path and filename (ex "C:\Users\Max\Documents\MyDocument.txt") what is the correct term?

What should I use for the parameter name? Would "file" be the appropriate name?

I feel kind of dumb asking this, but I want to make sure it's right.

Upvotes: 7

Views: 1035

Answers (7)

Chris S
Chris S

Reputation: 65436

One easier solution you may have considered already is telling the consumer of the API what is expected in the XML documentation, which will also appear in Visual Studio intellisense if your compile the assembly with documentation, and distribute the .xml file.

/// <summary>
/// Saves the provided file to disk.
/// </summary>
/// <param name="filePath">The full path, including the filename of the file.</param>
public void SaveFile(string filePath)
{

}

Upvotes: -1

Zuu
Zuu

Reputation: 1123

My suggestion would be "Absolute file path" for some path pointing to a file, where as i would use "Absolute directory path" for a path pointing to a directory

In case of relative paths the change should be obvious.

If nothing else, you can always make a section in your documentation where you describe the meaning of certain terms you use.

Upvotes: 3

slayerIQ
slayerIQ

Reputation: 1486

I'd go with fullPath like you said path would be C:\Users\Max\Documents but reading fullPath would suggest path + filename.

Upvotes: 0

benzado
benzado

Reputation: 84338

I don't think there is One True Answer, maybe some consensus, but that's all we can hope for. I usually try to follow the conventions of the library I'm using (e.g., Cocoa, Java, or PHP). If I've got nothing to go by, I'd say:

  • File: the abstract thing being referred to by a name: the file handle
  • Path: a string indicating the location of a file or directory, either absolute or relative: /Users/Max/Documents/FooBar, ../Sibling/Zardoz
  • Name: the name of the file or directory, without location: FooBar, Zardoz, Documents

Upvotes: -1

David Koelle
David Koelle

Reputation: 20824

The correct term is "Fully Qualified Name" (sometimes "FQN").

The term you should use in your API is "QualifiedName" or "QualifiedFilename"

Wikipedia has an entry for "Fully qualified file name" and defines it as "a file on a computer whose exact name is completely specified such that it is unambiguous and cannot be mistaken for any other file on that system."

Upvotes: 2

slebetman
slebetman

Reputation: 113906

Usually path is the full C:\Users\Max\Documents\MyDocument.txt while the C:\Users\Max\Documents\ part is usually known as the base directory or just directory.

You'll see in a lot of example code people write: C:\path\to\the\document.txt

Upvotes: 0

iandisme
iandisme

Reputation: 6396

A term often overused for this is URI, though your example isn't really one of those. I think you'll be perfectly clear if you just use "filepath" or "pathname."

For example, Java's file object uses "pathname" as the parameter name for the constructor on their File object.

Upvotes: 0

Related Questions