mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
proper separator for task file path
This commit is contained in:
+1
-1
@@ -345,7 +345,7 @@ public class StudyProjectComponent implements ProjectComponent {
|
||||
final TaskFile taskFile = new TaskFile();
|
||||
taskFile.initTaskFile(task, false);
|
||||
taskFile.setUserCreated(true);
|
||||
final String name = FileUtil.getRelativePath(taskDir.getPath(), createdFile.getPath(), File.separatorChar);
|
||||
final String name = FileUtil.getRelativePath(taskDir.getPath(), createdFile.getPath(), '/');
|
||||
taskFile.name = name;
|
||||
//TODO: put to other steps as well
|
||||
task.getTaskFiles().put(name, taskFile);
|
||||
|
||||
@@ -814,6 +814,6 @@ public class StudyUtils {
|
||||
public static String pathRelativeToTask(VirtualFile file) {
|
||||
VirtualFile taskDir = getTaskDir(file);
|
||||
if (taskDir == null) return file.getName();
|
||||
return FileUtil.getRelativePath(taskDir.getPath(), file.getPath(), File.separatorChar);
|
||||
return FileUtil.getRelativePath(taskDir.getPath(), file.getPath(), '/');
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -180,10 +180,10 @@ public class StudyProjectGenerator {
|
||||
final Map<String, TaskFile> taskFiles = firstTask.getTaskFiles();
|
||||
VirtualFile activeVirtualFile = null;
|
||||
for (Map.Entry<String, TaskFile> entry : taskFiles.entrySet()) {
|
||||
final String name = entry.getKey();
|
||||
final String relativePath = entry.getKey();
|
||||
final TaskFile taskFile = entry.getValue();
|
||||
taskDir.refresh(false, true);
|
||||
final VirtualFile virtualFile = VfsUtil.findRelativeFile(taskDir, name);
|
||||
final VirtualFile virtualFile = VfsUtil.findRelativeFile(taskDir, relativePath.split("/"));
|
||||
if (virtualFile != null) {
|
||||
FileEditorManager.getInstance(project).openFile(virtualFile, true);
|
||||
if (!taskFile.getActivePlaceholders().isEmpty()) {
|
||||
@@ -272,7 +272,7 @@ public class StudyProjectGenerator {
|
||||
public static void flushTask(@NotNull final Task task, @NotNull final File taskDirectory) {
|
||||
FileUtil.createDirectory(taskDirectory);
|
||||
for (Map.Entry<String, TaskFile> taskFileEntry : task.taskFiles.entrySet()) {
|
||||
final String name = taskFileEntry.getKey();
|
||||
final String name = FileUtil.toSystemDependentName(taskFileEntry.getKey());
|
||||
final TaskFile taskFile = taskFileEntry.getValue();
|
||||
final File file = new File(taskDirectory, name);
|
||||
FileUtil.createIfDoesntExist(file);
|
||||
|
||||
+1
-1
@@ -289,7 +289,7 @@ public class EduAdaptiveStepicConnector {
|
||||
File[] filesInTask = newResourceRoot.listFiles();
|
||||
if (filesInTask != null) {
|
||||
for (File file : filesInTask) {
|
||||
String taskRelativePath = FileUtil.getRelativePath(taskDir.getPath(), file.getPath(), File.separatorChar);
|
||||
String taskRelativePath = FileUtil.getRelativePath(taskDir.getPath(), file.getPath(), '/');
|
||||
if (taskRelativePath != null && !task.isTaskFile(taskRelativePath)) {
|
||||
File resourceFile = new File(newResourceRoot, taskRelativePath);
|
||||
File fileInProject = new File(taskDir.getCanonicalPath(), taskRelativePath);
|
||||
|
||||
Reference in New Issue
Block a user