Class LocalPaths
Helper methods for getting standard data file paths.
public static class LocalPaths
- Inheritance
-
LocalPaths
- Inherited Members
Properties
CommonApplicationDataOverride
Gets or sets an override for the common application data folder (i.e., used by GetCommonApplicationDataFilePath(string)).
public static string CommonApplicationDataOverride { get; set; }
Property Value
Remarks
If this is null, the folder is not overridden.
EntryAssemblyOverride
Gets or sets an override for the entry or root assembly used to construct application paths.
public static Assembly EntryAssemblyOverride { get; set; }
Property Value
Remarks
This should be called by ASP.NET applications since the entry assembly will be null, or by any Pinpoint subsystem designed to be hosted within some parent process. It can also be useful for unit testing.
Methods
GetCommonApplicationDataFilePath(string)
Gets the full path to a specified file in the common application data folder, under subdirectories for the product name and executing application's simple name. The directory is created if necessary.
public static string GetCommonApplicationDataFilePath(string fileName)
Parameters
fileName
stringThe file name for which to return a full path, or null to return the path to the folder only.
Returns
- string
The full path to the specified file or folder.
Remarks
For example, if Acuit.Pinpoint.Application is executing on Windows 7 when this is called for a file called "settings.config", the returned path would be:
C:\ProgramData\Acuit Pinpoint\Acuit.Pinpoint.Application\settings.config
This location should not be used for files that users should ever need to access, as it is normally hidden from view. If the user might ever need to find the file,
GetCommonDocumentsFilePath(string) should be used instead.
Exceptions
- ArgumentException
fileName
contains one or more of the invalid characters defined in GetInvalidPathChars().- InvalidOperationException
The entry assembly name cannot be determined. Consider setting the EntryAssemblyOverride property.
- IOException
The directory does not exist, but could not be created.
- UnauthorizedAccessException
The caller does not have the required permission.
GetCommonDocumentsFilePath(string)
Gets the full path to a specified file in the all-users documents folder, under subdirectories for the product name and executing application's simple name. The directory is created if necessary.
public static string GetCommonDocumentsFilePath(string fileName)
Parameters
fileName
stringThe file name for which to return a full path, or null to return the path to the folder only.
Returns
- string
The full path to the specified file or folder.
Remarks
For example, if Acuit Pinpoint Workstation is executing on Windows 7 when this is called for a file called "Errors.txt", the returned path would be:
C:\Users\Public\Documents\Acuit Pinpoint\Workstation\Errors.txt
Exceptions
- ArgumentException
fileName
contains one or more of the invalid characters defined in GetInvalidPathChars().- InvalidOperationException
The entry assembly name cannot be determined. Consider setting the EntryAssemblyOverride property.
- IOException
The directory does not exist, but could not be created.
- UnauthorizedAccessException
The caller does not have the required permission.
GetEntryAssemblyDirectory()
Gets the directory that contains the entry assembly.
public static string GetEntryAssemblyDirectory()
Returns
- string
The directory that contains the entry assembly.
Exceptions
- InvalidOperationException
The entry assembly cannot be determined. Consider setting the EntryAssemblyOverride property.