@@ -404,14 +404,27 @@ String vfsVenvPath() {
404
404
return resourcePathToPlatformPath (VENV_PREFIX );
405
405
}
406
406
407
- private String resourcePathToPlatformPath (String inputPath ) {
408
- assert inputPath .length () > VFS_ROOT .length () && inputPath .startsWith (VFS_ROOT ) : "inputPath expected to start with '" + VFS_ROOT + "' but was '" + inputPath + "'" ;
409
- var path = inputPath .substring (VFS_ROOT .length () + 1 );
407
+ /**
408
+ * Converts the given path starting with the internal resource root to the path as seen by
409
+ * Python IO. For example if no other mount point was set then the path
410
+ * "/org.graalvm.python.vfs/src/hello.py" will be converted to the default mount point
411
+ * "/graalpy_vfs/src/hello.py" .
412
+ *
413
+ * @deprecated use {@link #getMountPoint()} instead
414
+ */
415
+ @ Deprecated
416
+ public String resourcePathToPlatformPath (String resourcePath ) {
417
+ if (!(resourcePath .length () > VFS_ROOT .length () && resourcePath .startsWith (VFS_ROOT ))) {
418
+ String msg = "Resource path is expected to start with '" + VFS_ROOT + "' but was '" + resourcePath + "'.\n " +
419
+ "Please also ensure that your virtual file system resources root directory is '" + VFS_ROOT + "'" ;
420
+ throw new IllegalArgumentException (msg );
421
+ }
422
+ var path = resourcePath .substring (VFS_ROOT .length () + 1 );
410
423
if (!PLATFORM_SEPARATOR .equals (RESOURCE_SEPARATOR )) {
411
424
path = path .replace (RESOURCE_SEPARATOR , PLATFORM_SEPARATOR );
412
425
}
413
426
String absolute = mountPoint .resolve (path ).toString ();
414
- if (inputPath .endsWith (RESOURCE_SEPARATOR ) && !absolute .endsWith (PLATFORM_SEPARATOR )) {
427
+ if (resourcePath .endsWith (RESOURCE_SEPARATOR ) && !absolute .endsWith (PLATFORM_SEPARATOR )) {
415
428
absolute += PLATFORM_SEPARATOR ;
416
429
}
417
430
return absolute ;
0 commit comments