1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-04 03:40:07 +00:00

Projucer: Check if IDE project file exists when saving

This commit is contained in:
ed 2021-12-06 09:55:22 +00:00
parent 2224bb9760
commit a71bda9adb
6 changed files with 34 additions and 11 deletions

View file

@ -504,6 +504,9 @@ void ProjectContentComponent::openInSelectedIDE (bool saveFirst)
if (auto selectedExporter = headerComponent.getSelectedExporter())
{
if (! selectedExporter->canLaunchProject())
return;
if (saveFirst)
{
if (project->isTemporaryProject())
@ -512,7 +515,7 @@ void ProjectContentComponent::openInSelectedIDE (bool saveFirst)
return;
}
if (project->hasChangedSinceSaved())
if (project->hasChangedSinceSaved() || ! selectedExporter->getIDEProjectFile().exists())
{
project->saveAsync (true, true, [safeThis = SafePointer<ProjectContentComponent> { this }] (Project::SaveResult r)
{

View file

@ -141,7 +141,7 @@ public:
gradleVersion (settings, Ids::gradleVersion, getUndoManager(), "7.0.2"),
gradleToolchain (settings, Ids::gradleToolchain, getUndoManager(), "clang"),
androidPluginVersion (settings, Ids::androidPluginVersion, getUndoManager(), "7.0.0"),
AndroidExecutable (getAppSettings().getStoredPath (Ids::androidStudioExePath, TargetOS::getThisOS()).get().toString())
androidExecutable (getAppSettings().getStoredPath (Ids::androidStudioExePath, TargetOS::getThisOS()).get().toString())
{
name = getDisplayName();
targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderName());
@ -165,22 +165,25 @@ public:
//==============================================================================
bool canLaunchProject() override
{
return AndroidExecutable.exists();
return androidExecutable.exists();
}
bool launchProject() override
{
if (! AndroidExecutable.exists())
if (! androidExecutable.exists())
{
jassertfalse;
return false;
}
auto targetFolder = getTargetFolder();
// we have to surround the path with extra quotes, otherwise Android Studio
// will choke if there are any space characters in the path.
return AndroidExecutable.startAsProcess ("\"" + targetFolder.getFullPathName() + "\"");
return androidExecutable.startAsProcess (getIDEProjectFile().getFullPathName().quoted());
}
File getIDEProjectFile() const override
{
return getTargetFolder();
}
//==============================================================================
@ -1874,7 +1877,7 @@ private:
}
//==============================================================================
const File AndroidExecutable;
const File androidExecutable;
JUCE_DECLARE_NON_COPYABLE (AndroidProjectExporter)
};

View file

@ -126,7 +126,12 @@ public:
bool launchProject() override
{
return getCLionExecutableOrApp().startAsProcess (getTargetFolder().getFullPathName().quoted());
return getCLionExecutableOrApp().startAsProcess (getIDEProjectFile().getFullPathName().quoted());
}
File getIDEProjectFile() const override
{
return getTargetFolder();
}
String getDescription() override

View file

@ -1476,7 +1476,7 @@ public:
bool launchProject() override
{
#if JUCE_WINDOWS
return getSLNFile().startAsProcess();
return getIDEProjectFile().startAsProcess();
#else
return false;
#endif
@ -1491,6 +1491,11 @@ public:
#endif
}
File getIDEProjectFile() const override
{
return getSLNFile();
}
void createExporterProperties (PropertyListBuilder& props) override
{
props.add (new TextPropertyComponent (manifestFileValue, "Manifest file", 8192, false),

View file

@ -660,7 +660,7 @@ public:
bool launchProject() override
{
#if JUCE_MAC
return getProjectBundle().startAsProcess();
return getIDEProjectFile().startAsProcess();
#else
return false;
#endif
@ -675,6 +675,11 @@ public:
#endif
}
File getIDEProjectFile() const override
{
return getProjectBundle();
}
//==============================================================================
void create (const OwnedArray<LibraryModule>&) const override
{

View file

@ -89,6 +89,8 @@ public:
virtual bool isOSX() const = 0;
virtual bool isiOS() const = 0;
virtual File getIDEProjectFile() const { return {}; }
virtual String getNewLineString() const = 0;
virtual String getDescription() { return {}; }