docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class PathUtils

    Utility class to keep all path utils in one place

    Inheritance
    object
    PathUtils
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Perception.GroundTruth.Consumers
    Assembly: Unity.Perception.Runtime.dll
    Syntax
    public static class PathUtils

    Methods

    CheckAndFixFileName(string)

    Checks to see if a filename is legal. If it is not, the illegal characters will be updated to underscores (_) and returned. The passed in name should be the ultimate filename and not include the full path. All path separating slashes are considered illegal characters. This method returns true, and the unchanged string if the name is legal, false and the updated name if the passed in name is illegal.

    Declaration
    public static (bool, string) CheckAndFixFileName(string toCheck)
    Parameters
    Type Name Description
    string toCheck

    The name to check.

    Returns
    Type Description
    (bool, string)

    True and unchanged name if the filename is legal, false and the updated name if the filename is illegal.

    CombineUniversal(params string[])

    Combines paths together. This method always uses the alternative directory spacer, '/' on windows, mac, and linux machines so that paths written to json are consistent.

    Declaration
    public static string CombineUniversal(params string[] paths)
    Parameters
    Type Name Description
    string[] paths

    An arbitrary length array of paths to combine together.

    Returns
    Type Description
    string

    The combined path

    DoesFilenameIncludeIllegalCharacters(string)

    Checks to see if the passed in filename contains illegal characters. The passed in name should be the ultimate filename and not include the full path. All path separating slashes are considered illegal characters.

    Declaration
    public static bool DoesFilenameIncludeIllegalCharacters(string toCheck)
    Parameters
    Type Name Description
    string toCheck

    The string to check

    Returns
    Type Description
    bool

    True if the name contains illegal characters

    EnsurePathsAreUniversal(string)

    Replaces windows slashes "" with universal paths "/"

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

    The path to update

    Returns
    Type Description
    string

    The cleaned up path

    WriteAndReportImageFile(string, byte[])

    Writes image out to a file and registers the file with the simulation manager.

    Declaration
    public static void WriteAndReportImageFile(string path, byte[] bytes)
    Parameters
    Type Name Description
    string path

    The path to write to.

    byte[] bytes

    The image bytes.

    WriteAndReportJsonFile(string, JToken)

    Writes json out to a file and registers the file with the simulation manager.

    Declaration
    public static void WriteAndReportJsonFile(string filePath, JToken json)
    Parameters
    Type Name Description
    string filePath

    The path to write to.

    JToken json

    The json information to write out.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)