-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update FileUtils.java #364
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,6 @@ | |
********************************************************************************************************/ | ||
package gama.core.common.util; | ||
|
||
import static java.util.stream.Collectors.toList; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
@@ -19,7 +17,6 @@ | |
import java.net.URLDecoder; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
import java.util.List; | ||
|
||
import org.eclipse.core.filesystem.EFS; | ||
import org.eclipse.core.filesystem.IFileInfo; | ||
|
@@ -160,13 +157,14 @@ static public String constructAbsoluteFilePath(final IScope scope, final String | |
if (a == null) return fp; | ||
if (!a.isHeadless()) { | ||
// Necessary to ask the workspace for the containers as projects might be linked | ||
final List<IContainer> paths = a.getWorkingPaths().stream() | ||
.map(s -> ROOT.findContainersForLocation(new Path(s))[0]).collect(toList()); | ||
for (final IContainer folder : paths) { | ||
final String file = findInWorkspace(fp, folder, mustExist); | ||
if (file != null) { | ||
DEBUG.OUT("Hit with workspace-based search: " + file); | ||
return file; | ||
for (final String folder : a.getWorkingPaths()) { | ||
IContainer[] containers = ROOT.findContainersForLocation(new Path(folder)); | ||
for (IContainer container : containers) { | ||
final String file = findInWorkspace(fp, container, mustExist); | ||
if (file != null) { | ||
DEBUG.OUT("Hit with workspace-based search: " + file); | ||
return file; | ||
} | ||
Comment on lines
+160
to
+167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ Getting worse: Complex Method
Comment on lines
+160
to
+167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ Getting worse: Deep, Nested Complexity |
||
} | ||
} | ||
} | ||
|
@@ -419,10 +417,9 @@ public static URI getURI(final String target, final URI existingResource) { | |
return null; | ||
} | ||
} | ||
|
||
public static String escapeFilePath(String path) { | ||
return path .replace("\\", "\\\\") | ||
.replace("\"", "\\\""); | ||
|
||
public static String escapeFilePath(final String path) { | ||
return path.replace("\\", "\\\\").replace("\"", "\\\""); | ||
} | ||
|
||
/** | ||
|
@@ -479,13 +476,6 @@ public static IContainer getFolder(final String path, final URI root, final bool | |
return null; | ||
} | ||
|
||
// public static IFile linkAndGetExternalFile(final URI uri, final URI | ||
// workspaceResource) { | ||
// final String path = URI.decode(uri.isFile() ? uri.toFileString() : | ||
// uri.toString()); | ||
// return linkAndGetExternalFile(URI.decode(path), workspaceResource); | ||
// } | ||
|
||
/** | ||
* Creates the linked file. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 4.93 to 4.96, threshold = 4