Skip to content

Commit

Permalink
Only alter strings on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed Yarub Hani Al Nuaimi committed Oct 13, 2023
1 parent 16f4bdc commit 0e75e95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.impl.ProjectImpl;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.LanguageTextField;
import com.intellij.ui.LanguageTextField.SimpleDocumentCreator;
import com.intellij.ui.components.JBLabel;
Expand Down Expand Up @@ -184,7 +185,11 @@ private void setProjectViewText(String projectViewText) {
.runWriteAction(
() -> {
projectViewEditor.getDocument().setReadOnly(false);
projectViewEditor.getDocument().setText(projectViewText.replace("\r", ""));
if (SystemInfo.isWindows) {
projectViewEditor.getDocument().setText(projectViewText.replace("\r", ""));
} else {
projectViewEditor.getDocument().setText(projectViewText);
}
});
updateTextAreasEnabled();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.intellij.openapi.fileChooser.FileChooserFactory;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
Expand Down Expand Up @@ -168,7 +169,13 @@ private void chooseWorkspacePath() {
}
VirtualFile file = files[0];

if (!FileUtil.startsWith(file.getPath(), fileBrowserRoot.getPath().replace('\\', '/'))) {
boolean startsWithPath;
if (SystemInfo.isWindows) {
startsWithPath = FileUtil.startsWith(file.getPath(), fileBrowserRoot.getPath().replace('\\', '/'));
} else {
startsWithPath = FileUtil.startsWith(file.getPath(), fileBrowserRoot.getPath());
}
if (!startsWithPath) {
Messages.showErrorDialog(
String.format(
"You must choose a project view file under %s. "
Expand Down

0 comments on commit 0e75e95

Please sign in to comment.