5[BadInteropApi(
"Path",
true)]
18 [BadMethod(description:
"Returns the file name and extension of the specified path string.")]
19 [return: BadReturn(
"The characters after the last directory character in path.")]
20 private string
GetFileName([BadParameter(description:
"The Path to get the file name from.")] string path)
22 return Path.GetFileName(path);
25 [BadMethod(description:
"Returns the file name of the specified path string without the extension")]
26 [return: BadReturn(
"The string returned by GetFileName(string), minus the last period (.) and all characters following it")]
29 return Path.GetFileNameWithoutExtension(path);
32 [BadMethod(description:
"Returns the directory information for the specified path string")]
33 [return: BadReturn(
"Directory information for path, or null if path denotes a root directory or is null. Returns Empty if path does not contain directory information.")]
34 private string?
GetDirectoryName([BadParameter(description:
"The path of a file or directory.")] string path)
36 return Path.GetDirectoryName(path);
39 [BadMethod(description:
"Returns the extension of the specified path string.")]
40 [return: BadReturn(
"The extension of the specified path (including the period).")]
41 private string
GetExtension([BadParameter(description:
"The path of a file or directory.")] string path)
43 return Path.GetExtension(path);
46 [BadMethod(description:
"Returns the absolute path for the specified path string.")]
47 [return: BadReturn(
"The fully qualified location of path, such as \"C:\\MyFile.txt\" or \"/home/user/myFolder\".")]
48 private string
GetFullPath([BadParameter(description:
"The path of a file or directory.")] string path)
53 [BadMethod(description:
"Returns the Startup Directory.")]
54 [return: BadReturn(
"The Startup Directory")]
60 [BadMethod(description:
"Changes the extension of a path string.")]
61 [return: BadReturn(
"The modified path information.")]
63 [BadParameter(description:
"The path information to modify.")]
65 [BadParameter(description:
"The new extension (with or without a leading period). Specify null to remove an existing extension from path")]
68 return Path.ChangeExtension(path, extension);
71 [BadMethod(description:
"Combines two or more strings into a path.")]
72 [return: BadReturn(
"The combined path.")]
73 private string
Combine([BadParameter(description:
"The Path Parts")] params string[] parts)
75 return Path.Combine(parts);
Public interface for the filesystem abstraction of the BadScript Engine.
static IFileSystem Instance
File System implementation.
string GetExtension([BadParameter(description:"The path of a file or directory.")] string path)
string GetFileNameWithoutExtension([BadParameter(description:"The Path to get the file name from.")] string path)
readonly IFileSystem m_FileSystem
The FileSystem Instance.
string ChangeExtension([BadParameter(description:"The path information to modify.")] string path, [BadParameter(description:"The new extension (with or without a leading period). Specify null to remove an existing extension from path")] string extension)
string GetFullPath([BadParameter(description:"The path of a file or directory.")] string path)
BadPathApi(IFileSystem fileSystem)
string Combine([BadParameter(description:"The Path Parts")] params string[] parts)
string? GetDirectoryName([BadParameter(description:"The path of a file or directory.")] string path)
string GetFileName([BadParameter(description:"The Path to get the file name from.")] string path)
Defines the interface for a file system.
string GetStartupDirectory()
The Startup Directory of the Application.
string GetFullPath(string path)
Returns the full path of the given path.
Contains IO Implementation for the BadScript2 Runtime.
Contains IO Extensions and APIs for the BadScript2 Runtime.