How to use the @bentley/imodeljs-backend.IModelHost.appAssetsDir function in @bentley/imodeljs-backend

To help you get started, we’ve selected a few @bentley/imodeljs-backend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / example-code / app / src / backend / RobotWorldSchema.ts View on Github external
public static async importSchema(requestContext: ClientRequestContext | AuthorizedClientRequestContext, iModelDb: IModelDb): Promise {
    requestContext.enter();
    if (iModelDb.containsClass(_schemaNames.Class.Robot))
      return Promise.resolve();

    if (iModelDb.isReadonly)
      throw new IModelError(IModelStatus.ReadOnly, "importSchema failed because IModelDb is read-only");

    // Must import the schema. The schema must be installed alongside the app in its
    // assets directory. Note that, for portability, make sure the case of
    // the filename is correct!
    await iModelDb.importSchema(requestContext, path.join(IModelHost.appAssetsDir!, "RobotWorld.ecschema.xml"));
    requestContext.enter();

    // This is the right time to create definitions, such as Categories, that will
    // be used with the classes in this schema.
    RobotWorld.bootStrapDefinitions(iModelDb);

    return Promise.resolve();
  }
  // __PUBLISH_EXTRACT_END__
github imodeljs / imodeljs / test-apps / presentation-test-app / src / backend / SampleRpcImpl.ts View on Github external
private getAssetsDir(): string {
    if (IModelHost.appAssetsDir)
      return IModelHost.appAssetsDir;
    return "assets";
  }
github imodeljs / imodeljs / test-apps / presentation-test-app / src / backend / SampleRpcImpl.ts View on Github external
private getAssetsDir(): string {
    if (IModelHost.appAssetsDir)
      return IModelHost.appAssetsDir;
    return "assets";
  }