Skip to content
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

Fix Haxe path resolving from SDK #404

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
23 changes: 14 additions & 9 deletions src/common/com/intellij/plugins/haxe/util/HaxeHelpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@
*/
package com.intellij.plugins.haxe.util;

import com.intellij.execution.Platform;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkAdditionalData;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.plugins.haxe.config.sdk.HaxeSdkData;
import com.intellij.plugins.haxe.config.sdk.HaxeSdkType;

import java.io.File;

/**
* Created by as3boyan on 15.11.14.
Expand All @@ -31,16 +36,16 @@ public static String getHaxePath(Module myModule) {
String haxePath = "haxe";
if (myModule != null) {
Sdk sdk = ModuleRootManager.getInstance(myModule).getSdk();
if (sdk != null) {
SdkAdditionalData data = sdk.getSdkAdditionalData();
if (sdk != null && sdk.getSdkType().equals(HaxeSdkType.getInstance())) {
String path = FileUtil.toSystemIndependentName(sdk.getHomePath()) + "/haxe";

if (Platform.current().equals(Platform.WINDOWS)) {
path += ".exe";
}

if (data instanceof HaxeSdkData) {
HaxeSdkData sdkData;
sdkData = (HaxeSdkData)data;
String path = sdkData.getHomePath();
if (!path.isEmpty()) {
haxePath = path;
}
File file = new File(path);
if (!path.isEmpty() && file.exists() && file.isFile()) {
haxePath = path;
}
}
}
Expand Down