Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ protected CompletableFuture<Response> handleLaunchCommand(Arguments arguments, R
}
} else if (launchArguments.shortenCommandLine == ShortenApproach.ARGFILE) {
try {
Path tempfile = LaunchUtils.generateArgfile(launchArguments.classPaths, launchArguments.modulePaths);
launchArguments.vmArgs += " \"@" + tempfile.toAbsolutePath().toString() + "\"";
Path tempfile = LaunchUtils.generateArgfile(launchArguments.vmArgs, launchArguments.classPaths, launchArguments.modulePaths);
launchArguments.vmArgs = " \"@" + tempfile.toAbsolutePath().toString() + "\"";
launchArguments.classPaths = new String[0];
launchArguments.modulePaths = new String[0];
context.setArgsfile(tempfile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.microsoft.java.debug.core.adapter.AdapterUtils;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;

public class LaunchUtils {
Expand Down Expand Up @@ -81,10 +82,14 @@ public static synchronized Path generateClasspathJar(String[] classPaths) throws
* @return the file path of the generated argfile
* @throws IOException Some errors occur during generating the argfile
*/
public static synchronized Path generateArgfile(String[] classPaths, String[] modulePaths) throws IOException {
public static synchronized Path generateArgfile(String vmArgs, String[] classPaths, String[] modulePaths) throws IOException {
String argfile = "";
if (StringUtils.isNotBlank(vmArgs)) {
argfile += vmArgs;
}

if (ArrayUtils.isNotEmpty(classPaths)) {
argfile = "-cp \"" + String.join(File.pathSeparator, classPaths) + "\"";
argfile += " -cp \"" + String.join(File.pathSeparator, classPaths) + "\"";
}

if (ArrayUtils.isNotEmpty(modulePaths)) {
Expand Down