mirror of
https://github.com/hexedtech/codemp-intellij.git
synced 2024-11-24 08:04:47 +01:00
fix: check if folder exists before trying to create it
This commit is contained in:
parent
db89c781a6
commit
7995b8db45
2 changed files with 6 additions and 2 deletions
|
@ -47,8 +47,11 @@ public class FileUtil {
|
|||
if(found == null) {
|
||||
VirtualFile lastParent = contentRoot;
|
||||
String[] path = bufferName.split("/");
|
||||
for(int i = 0; i < path.length - 1; i++)
|
||||
lastParent = lastParent.createChildDirectory(requestor, path[i]);
|
||||
for(int i = 0; i < path.length - 1; i++) {
|
||||
VirtualFile current = lastParent.findChild(path[i]);
|
||||
if(current == null) current = lastParent.createChildDirectory(requestor, path[i]);
|
||||
lastParent = current;
|
||||
}
|
||||
found = lastParent.createChildData(requestor, path[path.length - 1]);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ public class BufferCallback implements Consumer<BufferController> {
|
|||
() -> changeList.forEach((change) -> {
|
||||
editor.getDocument().replaceString((int) change.start, (int) change.end, change.content);
|
||||
// check for validity, force-sync if mismatch
|
||||
// TODO: prompt instead of doing it silently
|
||||
if(change.hash.isPresent() && change.hash.getAsLong() != Extensions.hash(editor.getDocument().getText())) {
|
||||
try {
|
||||
editor.getDocument().setText(bufferController.getContent());
|
||||
|
|
Loading…
Reference in a new issue