Escape result of FileLocator.resolve(url)

前端 未结 3 1926
孤独总比滥情好
孤独总比滥情好 2021-02-15 15:31

The method FileLocator.resolve(url) can be used to translate an address bundleentry://something/somewhere/x.txt to a proper file URL for /mnt/foo

3条回答
  •  眼角桃花
    2021-02-15 16:04

    I just found this code:

    http://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/BundledSystemLibrary.java?r=2057

    The relevant lines indeed help:

    // We need to use the 3-arg constructor of URI in order to properly escape file system chars.
    URI resolvedUri = new URI(resolvedUrl.getProtocol(), resolvedUrl.getPath(), null);
    

提交回复
热议问题