[shelf]: Store shelf paths only in system Independent way

This commit is contained in:
Nadya Zabrodina
2015-08-24 20:14:00 +03:00
parent 845e851d63
commit 5689c7b498
3 changed files with 13 additions and 6 deletions
@@ -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) {
@@ -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 {
@@ -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<ShelvedBinaryFile> binaryFiles, final long time) {
PATH = path;
PATH = FileUtil.toSystemIndependentName(path);
DESCRIPTION = description;
DATE = new Date(time);
myBinaryFiles = binaryFiles;