convertRelativePath method

  1. @override
String convertRelativePath(
  1. int rootId,
  2. String path
)
override

Implementation

@override
String convertRelativePath(int rootId, String path) {
  var instanceContext = getLoadContext(rootId);
  if (instanceContext != null && path.startsWith("hpfile://")) {
    var relativePath = path.replaceFirst("hpfile://./", "");
    var bundleLoaderPath = instanceContext.bundleLoader?.path;
    if (bundleLoaderPath != null) {
      path = bundleLoaderPath.substring(
              0, bundleLoaderPath.lastIndexOf(Platform.pathSeparator) + 1) +
          relativePath;
    }
  }
  return path;
}