Show / Hide Table of Contents

Class PathUtilities

Contains utility functions related to file paths

Inheritance
object
PathUtilities
Namespace: WeaverCore.Utilities
Assembly: WeaverCore.dll
Syntax
public static class PathUtilities

Fields

| Edit this page View Source

AssetsFolder

A path to the "Assets" directory in the Unity Project

Declaration
public static readonly DirectoryInfo AssetsFolder
Field Value
Type Description
DirectoryInfo
| Edit this page View Source

ProjectFolder

A path to the Project directory in the Unity Project

Declaration
public static readonly DirectoryInfo ProjectFolder
Field Value
Type Description
DirectoryInfo
| Edit this page View Source

reservedCharacters

A list of reserved characters that can't exist in a file's name

Declaration
public static readonly string reservedCharacters
Field Value
Type Description
string

Methods

| Edit this page View Source

AddSlash(DirectoryInfo)

Ensures that a slash is added to the end of a path

Declaration
public static string AddSlash(this DirectoryInfo directory)
Parameters
Type Name Description
DirectoryInfo directory
Returns
Type Description
string

Returns the path but with a slash at the end

| Edit this page View Source

AddSlash(string)

Ensures that a slash is added to the end of a path

Declaration
public static string AddSlash(string path)
Parameters
Type Name Description
string path

The path to add a slash to

Returns
Type Description
string

Returns the path but with a slash at the end

| Edit this page View Source

ConvertToAssetPath(string)

Converts an absolute path into a path that is relative to the "Assets" folder

Declaration
public static string ConvertToAssetPath(string path)
Parameters
Type Name Description
string path

The absolute path to be made relative

Returns
Type Description
string

Returns the path but relative to the "Assets" folder

| Edit this page View Source

ConvertToProjectPath(string)

Converts an absolute path into a path that is relative to the Project folder

Declaration
public static string ConvertToProjectPath(string path)
Parameters
Type Name Description
string path

The absolute path to be made relative

Returns
Type Description
string

Returns the path but relative to the Project folder

| Edit this page View Source

GetFileName(FileInfo)

Returns the file name (without the extension)

Declaration
public static string GetFileName(this FileInfo info)
Parameters
Type Name Description
FileInfo info
Returns
Type Description
string
| Edit this page View Source

MakePathRelative(DirectoryInfo, string)

Makes a global path relative to an existing directory

Declaration
public static string MakePathRelative(DirectoryInfo relativeTo, string path)
Parameters
Type Name Description
DirectoryInfo relativeTo

The existing directory that the new path will be made relative to

string path

The path that will be made relative to the "relativeTo" path

Returns
Type Description
string

Returns a new path that is relative to the "relativeTo" directory

| Edit this page View Source

MakePathRelative(string, string)

Makes a global path relative to an existing directory

Declaration
public static string MakePathRelative(string relativeTo, string path)
Parameters
Type Name Description
string relativeTo

The existing directory that the new path will be made relative to

string path

The path that will be made relative to the "relativeTo" path

Returns
Type Description
string

Returns a new path that is relative to the "relativeTo" directory

| Edit this page View Source

MakePathsRelative(DirectoryInfo, IEnumerable<string>)

Makes a list of paths relative to an existing directory

Declaration
public static IEnumerable<string> MakePathsRelative(DirectoryInfo relativeTo, IEnumerable<string> paths)
Parameters
Type Name Description
DirectoryInfo relativeTo

The existing directory that the new path will be made relative to

IEnumerable<string> paths

The paths that will be made relative to the "relativeTo" path

Returns
Type Description
IEnumerable<string>

Returns a list of new paths that are relative to the "relativeTo" directory

| Edit this page View Source

MakePathsRelative(string, IEnumerable<string>)

Makes a list of paths relative to an existing directory

Declaration
public static IEnumerable<string> MakePathsRelative(string relativeTo, IEnumerable<string> paths)
Parameters
Type Name Description
string relativeTo

The existing directory that the new path will be made relative to

IEnumerable<string> paths

The paths that will be made relative to the "relativeTo" path

Returns
Type Description
IEnumerable<string>

Returns a list of new paths that are relative to the "relativeTo" directory

| Edit this page View Source

RemoveURIEscapeChars(string)

Converts url escape characters into their actual characters

Declaration
public static string RemoveURIEscapeChars(string input)
Parameters
Type Name Description
string input

The path to filter

Returns
Type Description
string

Returns the path but with the URL Escape Characters removed

Remarks

See here for more info on URL Escape Characters : https://docs.microfocus.com/OMi/10.62/Content/OMi/ExtGuide/ExtApps/URL_encoding.htm

| Edit this page View Source

ReplaceSlashes(string)

Replaces all backslashes () with forward slashes (/) to make the path work with some unity functions

Declaration
public static string ReplaceSlashes(string path)
Parameters
Type Name Description
string path
Returns
Type Description
string
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Generated by DocFX
☀
☾