fix IDE generation file paths assuming CWD == project root, close #72

dev/0.11
Adrian Siekierka 2019-04-21 11:48:00 +02:00
parent bed0bba2da
commit 07ab36a97d
3 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ public class GenIdeaProjectTask extends DefaultLoomTask {
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
project.getLogger().lifecycle(":Building idea workspace"); project.getLogger().lifecycle(":Building idea workspace");
File file = new File(project.getName() + ".iws"); File file = project.file(project.getName() + ".iws");
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(file); Document doc = docBuilder.parse(file);

View File

@ -46,7 +46,7 @@ public class GenVsCodeProjectTask extends DefaultLoomTask {
@TaskAction @TaskAction
public void genRuns() { public void genRuns() {
LoomGradleExtension extension = getProject().getExtensions().getByType(LoomGradleExtension.class); LoomGradleExtension extension = getProject().getExtensions().getByType(LoomGradleExtension.class);
File projectDir = new File(".vscode"); File projectDir = getProject().file(".vscode");
if (!projectDir.exists()) { if (!projectDir.exists()) {
projectDir.mkdir(); projectDir.mkdir();
} }

View File

@ -38,7 +38,7 @@ public class SetupIntelijRunConfigs {
public static void setup(Project project) { public static void setup(Project project) {
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
File projectDir = new File(".idea"); File projectDir = project.file(".idea");
if(!projectDir.exists()){ if(!projectDir.exists()){
return; return;
} }
@ -61,7 +61,7 @@ public class SetupIntelijRunConfigs {
MinecraftAssetsProvider.provide(extension.getMinecraftProvider(), project); MinecraftAssetsProvider.provide(extension.getMinecraftProvider(), project);
} }
File projectDir = new File(".idea"); File projectDir = project.file(".idea");
File runConfigsDir = new File(projectDir, "runConfigurations"); File runConfigsDir = new File(projectDir, "runConfigurations");
File clientRunConfigs = new File(runConfigsDir, "Minecraft_Client.xml"); File clientRunConfigs = new File(runConfigsDir, "Minecraft_Client.xml");
File serverRunConfigs = new File(runConfigsDir, "Minecraft_Server.xml"); File serverRunConfigs = new File(runConfigsDir, "Minecraft_Server.xml");