Skip to content

Commit ebeca69

Browse files
committed
eim message if not in applicaitons on macos
1 parent 05ec02b commit ebeca69

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/Messages.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public class Messages extends NLS
5050
public static String OldConfigExportCompleteSuccessMsg;
5151
public static String OldConfigExportCompleteFailMsgTitle;
5252
public static String OldConfigExportCompleteFailMsg;
53+
54+
public static String EIMNotInApplicationsTitle;
55+
public static String EIMNotInApplicationsMessage;
5356

5457
static
5558
{

bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/messages.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ IDFToolChainsMissingErrorMsg=Toolchains are missing. Please use ESP-IDF Manager
3131
NoActiveEspIdfInWorkspaceMsgTitle=ESP-IDF Setup
3232
NoActiveEspIdfInWorkspaceMsg=ESP-IDF is required to use Espressif IDE. Would you like to configure it now?
3333

34+
EIMNotInApplicationsTitle=EIM Not Located in Applications Folder
35+
EIMNotInApplicationsMessage=Espressif Installation Manager (EIM) is not located in the Applications folder.\nRunning EIM from a temporary location (e.g., a mounted disk image) may cause issues during configuration import or tool setup.\nTo avoid problems, please move EIM to the /Applications directory and launch it from there.
36+
3437
OldConfigFoundMsgBoxTitle=Old Configuration Detected
3538
OldConfigFoundMsgBoxMsg=Espressif IDE now uses the EIM system to manage ESP-IDF installations. A legacy configuration was found in your current workspace. Converting it to the EIM format will allow proper environment setup and ensure the IDE works seamlessly with your existing projects. Would you like to convert the configuration now?
3639
OldConfigExportDirectorSelectionDialogTitle=Select Destination

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/EspressifToolStartup.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
package com.espressif.idf.ui.tools;
66

77
import java.io.IOException;
8+
import java.nio.file.Files;
89
import java.nio.file.Paths;
910

1011
import org.eclipse.core.runtime.IProgressMonitor;
1112
import org.eclipse.core.runtime.IStatus;
13+
import org.eclipse.core.runtime.Platform;
1214
import org.eclipse.core.runtime.Status;
1315
import org.eclipse.core.runtime.jobs.Job;
1416
import org.eclipse.jface.dialogs.MessageDialog;
@@ -88,6 +90,12 @@ public void earlyStartup()
8890
if (toolInitializer.isOldEspIdfConfigPresent() && !toolInitializer.isOldConfigExported())
8991
{
9092
Logger.log("Old configuration found and not converted");
93+
boolean isEimInApplications = checkIfEimPathMacOsIsInApplications();
94+
if (!isEimInApplications)
95+
{
96+
promptUserToMoveEimToApplications();
97+
}
98+
9199
EimJsonWatchService.withPausedListeners(()-> handleOldConfigExport());
92100
}
93101
else if (toolInitializer.isEimIdfJsonPresent() && !toolInitializer.isEspIdfSet())
@@ -105,6 +113,29 @@ else if (toolInitializer.isEimIdfJsonPresent() && !toolInitializer.isEspIdfSet()
105113
}
106114
}
107115

116+
private boolean checkIfEimPathMacOsIsInApplications()
117+
{
118+
if (!Platform.getOS().equals(Platform.OS_MACOSX))
119+
return true;
120+
121+
String eimPath = idfEnvironmentVariables.getEnvValue(IDFEnvironmentVariables.EIM_PATH);
122+
if (!StringUtil.isEmpty(eimPath))
123+
{
124+
if (Files.exists(Paths.get(eimPath)))
125+
{
126+
boolean isInApplications = eimPath.startsWith("/Applications/") ||
127+
eimPath.startsWith(System.getProperty("user.home") + "/Applications/");
128+
if (!isInApplications)
129+
{
130+
Logger.log("EIM_PATH not in applications: " + eimPath);
131+
return false;
132+
}
133+
}
134+
}
135+
136+
return true;
137+
}
138+
108139
private void handleOldConfigExport()
109140
{
110141
final int[] response = new int[] { -1 };
@@ -244,6 +275,15 @@ private void promptUserToOpenToolManager(EimJson eimJson)
244275
}
245276
});
246277
}
278+
279+
private void promptUserToMoveEimToApplications()
280+
{
281+
Display.getDefault().asyncExec(() -> {
282+
MessageDialog.openInformation(
283+
Display.getDefault().getActiveShell(),
284+
Messages.EIMNotInApplicationsTitle, Messages.EIMNotInApplicationsMessage);
285+
});
286+
}
247287

248288
private void openEspIdfManager(EimJson eimJson)
249289
{

0 commit comments

Comments
 (0)