RSDFileResultUtility

public class RSDFileResultUtility

RSDFileResultUtility is a utility for naming temporary files used to save task results.

  • Convenience method for creating a file URL to use as the location to save data.

    This utility will create a directory from the identifier by scrubbing the identifier string of any non-alphanumeric characters and then using the first 12 characters of the resulting string. If the resulting string is empty then temp will be used. The method then creates the directory if needed.

    Next, a UUID is created and the first 8 characters of the UUID are used as the filename.

    The purpose of using this method is two-fold. First, it uses a directory that is simplier for developers to find while developing a recorder. Second, it limits the length of the file path components to avoid issues with length limits in the stored filename if the name is stored to a database.

    Throws

    An exception if the file directory cannot be created.

    Declaration

    Swift

    public static func createFileURL(identifier: String, ext: String, outputDirectory: URL) throws -> URL

    Parameters

    identifier

    The identifier string for the step or configuration that will use the file.

    ext

    The file extension.

    outputDirectory

    File URL for the directory in which to store generated data files.

    Return Value

    Scrubbed URL for the given identifier.