mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
VfsUtilCore.fileToUrl API: VfsUtilCore.pathToUrl should also path convert to system-independent name
This commit is contained in:
@@ -118,7 +118,7 @@ public class NewProjectUtil {
|
||||
canonicalPath = FileUtil.resolveShortWindowsName(compileOutput);
|
||||
}
|
||||
catch (IOException ignored) { }
|
||||
extension.setCompilerOutputUrl(VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(canonicalPath)));
|
||||
extension.setCompilerOutputUrl(VfsUtilCore.pathToUrl(canonicalPath));
|
||||
}
|
||||
}), null, null);
|
||||
|
||||
|
||||
@@ -559,7 +559,7 @@ public class JarRepositoryManager {
|
||||
}
|
||||
}
|
||||
// search for jar file first otherwise lib root won't be found!
|
||||
manager.refreshAndFindFileByUrl(VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(toFile.getPath())));
|
||||
manager.refreshAndFindFileByUrl(VfsUtilCore.pathToUrl(toFile.getPath()));
|
||||
final String url = VfsUtil.getUrlForLibraryRoot(toFile);
|
||||
final VirtualFile file = manager.refreshAndFindFileByUrl(url);
|
||||
if (file != null) {
|
||||
|
||||
@@ -198,7 +198,7 @@ public class BuildElementsEditor extends ModuleElementsEditor {
|
||||
catch (IOException e) {
|
||||
canonicalPath = path;
|
||||
}
|
||||
commitPathRunnable.saveUrl(VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(canonicalPath)));
|
||||
commitPathRunnable.saveUrl(VfsUtilCore.pathToUrl(canonicalPath));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -248,6 +248,6 @@ public abstract class ProjectOpenProcessorBase<T extends ProjectImportBuilder> e
|
||||
path = FileUtil.resolveShortWindowsName(path);
|
||||
}
|
||||
catch (IOException ignored) { }
|
||||
return VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(path));
|
||||
return VfsUtilCore.pathToUrl(path);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.JavaModuleExternalPaths;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
@@ -27,7 +26,7 @@ public class DeprecationInspectionTest extends InspectionTestCase {
|
||||
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
|
||||
super.configureModule(module, model, contentEntry);
|
||||
model.getModuleExtension(JavaModuleExternalPaths.class)
|
||||
.setExternalAnnotationUrls(new String[]{VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(getTestDataPath() + "/deprecation/" + getTestName(true) + "/extAnnotations"))});
|
||||
.setExternalAnnotationUrls(new String[]{VfsUtilCore.pathToUrl(getTestDataPath() + "/deprecation/" + getTestName(true) + "/extAnnotations")});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -123,7 +123,7 @@ public class JavaModuleBuilder extends ModuleBuilder implements SourcePathsBuild
|
||||
canonicalPath = myCompilerOutputPath;
|
||||
}
|
||||
compilerModuleExtension
|
||||
.setCompilerOutputPath(VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(canonicalPath)));
|
||||
.setCompilerOutputPath(VfsUtilCore.pathToUrl(canonicalPath));
|
||||
}
|
||||
else {
|
||||
compilerModuleExtension.inheritCompilerOutputPath(true);
|
||||
|
||||
@@ -87,7 +87,7 @@ public abstract class ExecutionTestCase extends IdeaTestCase {
|
||||
PsiTestUtil.addContentRoot(myModule, moduleDir);
|
||||
PsiTestUtil.addSourceRoot(myModule, srcDir);
|
||||
IdeaTestUtil.setModuleLanguageLevel(myModule, LanguageLevel.JDK_1_8);
|
||||
PsiTestUtil.setCompilerOutputPath(myModule, VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(myModuleOutputDir.getAbsolutePath())), false);
|
||||
PsiTestUtil.setCompilerOutputPath(myModule, VfsUtilCore.pathToUrl(myModuleOutputDir.getAbsolutePath()), false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -408,12 +408,12 @@ public class VfsUtilCore {
|
||||
|
||||
@NotNull
|
||||
public static String pathToUrl(@NotNull String path) {
|
||||
return VirtualFileManager.constructUrl(URLUtil.FILE_PROTOCOL, path);
|
||||
return VirtualFileManager.constructUrl(URLUtil.FILE_PROTOCOL, FileUtil.toSystemIndependentName(path));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String fileToUrl(@NotNull File file) {
|
||||
return pathToUrl(FileUtil.toSystemIndependentName(file.getPath()));
|
||||
return pathToUrl(file.getPath());
|
||||
}
|
||||
|
||||
public static List<File> virtualToIoFiles(@NotNull Collection<? extends VirtualFile> files) {
|
||||
|
||||
@@ -181,7 +181,7 @@ public abstract class IntegrationTestCase extends PlatformTestCase {
|
||||
ModifiableRootModel m = rm.getModifiableModel();
|
||||
for (ContentEntry e : m.getContentEntries()) {
|
||||
if (!Comparing.equal(e.getFile(), myRoot)) continue;
|
||||
e.addExcludeFolder(VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(path)));
|
||||
e.addExcludeFolder(VfsUtilCore.pathToUrl(path));
|
||||
}
|
||||
m.commit();
|
||||
});
|
||||
|
||||
@@ -608,7 +608,7 @@ public class DirectoryIndexTest extends DirectoryIndexTestCase {
|
||||
ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
|
||||
rootModel.getContentEntries()[0]
|
||||
.addExcludeFolder(VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(f.getParentFile().getParent())));
|
||||
.addExcludeFolder(VfsUtilCore.pathToUrl(f.getParentFile().getParent()));
|
||||
rootModel.commit();
|
||||
|
||||
ModuleRootModificationUtil.addContentRoot(myModule2, FileUtil.toSystemIndependentName(f.getPath()));
|
||||
|
||||
@@ -149,7 +149,7 @@ public class PluginBuildConfiguration implements PersistentStateComponent<Plugin
|
||||
|
||||
public void setPluginXmlPathAndCreateDescriptorIfDoesntExist(final String pluginXmlPath) {
|
||||
myPluginXmlContainer.getConfiguration().removeConfigFiles(PluginDescriptorConstants.META_DATA);
|
||||
WriteAction.runAndWait(() -> createDescriptor(VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(pluginXmlPath))));
|
||||
WriteAction.runAndWait(() -> createDescriptor(VfsUtilCore.pathToUrl(pluginXmlPath)));
|
||||
}
|
||||
|
||||
public void setManifestPath(@Nullable String manifestPath) {
|
||||
@@ -162,7 +162,7 @@ public class PluginBuildConfiguration implements PersistentStateComponent<Plugin
|
||||
if (manifest == null) {
|
||||
Messages.showErrorDialog(myModule.getProject(), DevKitBundle.message("error.file.not.found.message", manifestPath), DevKitBundle.message("error.file.not.found"));
|
||||
ReadAction.run(()-> myManifestFilePointer = VirtualFilePointerManager.getInstance().create(
|
||||
VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(manifestPath)), myModule, null));
|
||||
VfsUtilCore.pathToUrl(manifestPath), myModule, null));
|
||||
}
|
||||
else {
|
||||
WriteAction.run(()-> myManifestFilePointer = VirtualFilePointerManager.getInstance().create(manifest, myModule, null));
|
||||
|
||||
Reference in New Issue
Block a user