From 5689c7b498d65892b8aadde61d777f31f7ed2fd3 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Mon, 24 Aug 2015 16:10:24 +0300 Subject: [PATCH] [shelf]: Store shelf paths only in system Independent way --- .../vcs/changes/shelf/ShelveChangesManager.java | 4 ++-- .../openapi/vcs/changes/shelf/ShelvedBinaryFile.java | 12 +++++++++--- .../openapi/vcs/changes/shelf/ShelvedChangeList.java | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java index 60e14bad5c98..e6eb835179c7 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java @@ -196,7 +196,7 @@ public class ShelveChangesManager extends AbstractProjectComponent implements JD File newPatchFile = getPatchFileInConfigDir(targetDirectory); try { FileUtil.copy(patchFile, newPatchFile); - list.PATH = newPatchFile.getPath(); + list.PATH = FileUtil.toSystemIndependentName(newPatchFile.getPath()); FileUtil.delete(patchFile); } catch (IOException e) { @@ -211,7 +211,7 @@ public class ShelveChangesManager extends AbstractProjectComponent implements JD File newShelvedFile = new File(targetDirectory, PathUtil.getFileName(file.AFTER_PATH)); try { FileUtil.copy(shelvedFile, newShelvedFile); - file.SHELVED_PATH = newShelvedFile.getPath(); + file.SHELVED_PATH = FileUtil.toSystemIndependentName(newShelvedFile.getPath()); FileUtil.delete(shelvedFile); } catch (IOException e) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedBinaryFile.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedBinaryFile.java index c0a1b8162fb7..bf21c199bb33 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedBinaryFile.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedBinaryFile.java @@ -21,6 +21,7 @@ import com.intellij.openapi.util.DefaultJDOMExternalizer; import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.JDOMExternalizable; import com.intellij.openapi.util.WriteExternalException; +import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.FileStatus; import com.intellij.openapi.vcs.VcsBundle; @@ -49,9 +50,14 @@ public class ShelvedBinaryFile implements JDOMExternalizable { public ShelvedBinaryFile(final String beforePath, final String afterPath, @Nullable final String shelvedPath) { assert beforePath != null || afterPath != null; - BEFORE_PATH = beforePath; - AFTER_PATH = afterPath; - SHELVED_PATH = shelvedPath; + BEFORE_PATH = convertToSystemIndependent(beforePath); + AFTER_PATH = convertToSystemIndependent(afterPath); + SHELVED_PATH = convertToSystemIndependent(shelvedPath); + } + + @Nullable + private String convertToSystemIndependent(@Nullable String beforePath) { + return beforePath != null ? FileUtil.toSystemIndependentName(beforePath) : null; } public void readExternal(Element element) throws InvalidDataException { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangeList.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangeList.java index c4e2e72ca3b2..834f37e74455 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangeList.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangeList.java @@ -31,6 +31,7 @@ import com.intellij.openapi.util.DefaultJDOMExternalizer; import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.JDOMExternalizable; import com.intellij.openapi.util.WriteExternalException; +import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vcs.FileStatus; import org.jdom.Element; import org.jetbrains.annotations.NonNls; @@ -65,7 +66,7 @@ public class ShelvedChangeList implements JDOMExternalizable, ExternalizableSche } public ShelvedChangeList(final String path, final String description, final List binaryFiles, final long time) { - PATH = path; + PATH = FileUtil.toSystemIndependentName(path); DESCRIPTION = description; DATE = new Date(time); myBinaryFiles = binaryFiles;