MSFAssetUtils

Objective-C


@interface MSFAssetUtils : NSObject {
  void *swigCPtr;
  BOOL swigCMemOwn;
}

Swift

class MSFAssetUtils : NSObject

A helper class for managing application-bundled assets.

  • Loads the specified bundled resource.

    Declaration

    Objective-C

    + (MSFBinaryData *)loadAsset:(NSString *)path;

    Swift

    class func loadAsset(_ path: String!) -> MSFBinaryData!

    Parameters

    path

    The path of the resource to load. The path is relative to application root folder.

    Return Value

    The loaded resource as a byte vector or null if the resource was not found or could not be loaded.

  • Returns true if the specified bundled asset exists and is a FILE (not a directory). Unlike loadAsset this does not read or log anything, so it can be used to probe.

    Declaration

    Objective-C

    + (BOOL)assetExists:(NSString *)path;

    Swift

    class func assetExists(_ path: String!) -> Bool

    Parameters

    path

    The path of the asset, relative to the application root folder.

    Return Value

    True if the asset exists as a file.

  • Lists the names of the assets directly inside the specified bundled directory. The listing is NOT recursive and does not tell files and directories apart - an entry is a directory if listing it returns something, a file if assetExists returns true for it. The contract matches Android’s, where the NDK asset API cannot do better.

    Declaration

    Objective-C

    + (MSFStringVector *)listAssets:(NSString *)path;

    Swift

    class func listAssets(_ path: String!) -> MSFStringVector!

    Parameters

    path

    The directory path, relative to the application root folder (“” is the root).

    Return Value

    The names of the entries in that directory, without any path prefix.

  • Calculates path for the bundled resource.

    Declaration

    Objective-C

    + (NSString *)calculateResourcePath:(NSString *)resourceName;

    Swift

    class func calculateResourcePath(_ resourceName: String!) -> String!

    Parameters

    resourceName

    The name of the resource.

    Return Value

    The full path for the resource. Result will be empty string if the resource was not found.

  • Calculates writable path for the given file name.

    Declaration

    Objective-C

    + (NSString *)calculateWritablePath:(NSString *)fileName;

    Swift

    class func calculateWritablePath(_ fileName: String!) -> String!

    Parameters

    fileName

    The file name to use.

    Return Value

    The full path for the given file name.

  • Undocumented

    Declaration

    Objective-C

    -(void)dealloc;

    Swift

    func dealloc()