Skip to content

Commit ac8a17d

Browse files
committed
#39: Warn the user if they will be overwriting an existing project
1 parent bc636ec commit ac8a17d

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

source/Info.plist

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>CFBundleExecutable</key>
88
<string>$(PRODUCT_NAME)</string>
99
<key>CFBundleGetInfoString</key>
10-
<string>$(PRODUCT_NAME) (c) 2023 Ravbug</string>
10+
<string>$(PRODUCT_NAME) (c) 2024 Ravbug</string>
1111
<key>CFBundleIconFile</key>
1212
<string>wxmac.icns</string>
1313
<key>CFBundleIdentifier</key>
@@ -22,21 +22,21 @@
2222
<string>it</string>
2323
</array>
2424
<key>CFBundleLongVersionString</key>
25-
<string>(c) 2023 Ravbug</string>
25+
<string>(c) 2024 Ravbug</string>
2626
<key>CFBundleName</key>
2727
<string>$(PRODUCT_NAME)</string>
2828
<key>CFBundlePackageType</key>
2929
<string>APPL</string>
3030
<key>CFBundleShortVersionString</key>
31-
<string>1.53</string>
31+
<string>1.54</string>
3232
<key>CFBundleSignature</key>
3333
<string>UNHn</string>
3434
<key>CFBundleVersion</key>
3535
<string>$(CURRENT_PROJECT_VERSION)</string>
3636
<key>LSApplicationCategoryType</key>
3737
<string>public.app-category.developer-tools</string>
3838
<key>NSHumanReadableCopyright</key>
39-
<string>Copyright 2023 Ravbug</string>
39+
<string>Copyright 2024 Ravbug</string>
4040
<key>NSPrincipalClass</key>
4141
<string>wxNSApplication</string>
4242
</dict>

source/create_dialog_derived.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#endif
1313
#include <wx/msgdlg.h>
1414
#include <fmt/format.h>
15+
#include <wx/choicdlg.h>
1516

1617
using namespace std;
1718

@@ -69,13 +70,28 @@ void CreateProjectDialogD::OnCreate(wxCommandEvent& event){
6970
//validate form
7071
string message = validateForm();
7172
if (message == ""){
73+
74+
7275
//assemble the command that will create the project described by the dialog
7376

7477
editor& e = editors[GetSelectedEditorIndex()];
7578
auto executablePath = e.path / e.name / executable;
7679
auto executableTemplatesPath = e.path / e.name / templatesDir;
7780
string projName = projNameTxt->GetValue().ToStdString();
7881
string projPath = projLocTxt->GetValue().ToStdString();
82+
83+
auto outPath = filesystem::path(projPath) / projName;
84+
85+
// extra check: ensure that the location to write the project doesn't already have a project
86+
{
87+
auto projectversionpath = outPath / "ProjectSettings" / "ProjectVersion.txt";
88+
if (std::filesystem::exists(projectversionpath)){
89+
auto answer = wxMessageBox(fmt::format("A Unity project already exists at {}. Overwrite it?", outPath.string()),"Project Already Exists", wxYES_NO);
90+
if (answer != wxYES){
91+
return;
92+
}
93+
}
94+
}
7995

8096
//get the selected template
8197
long itemIndex = wxListCtrl_get_selected(templateCtrl);
@@ -88,7 +104,7 @@ void CreateProjectDialogD::OnCreate(wxCommandEvent& event){
88104
#if defined __APPLE__
89105
string command = fmt::format("\"{}\" -createProject \"{}\" -cloneFromTemplate \"{}{}.{}\"",
90106
executablePath.string(),
91-
(filesystem::path(projPath) / projName).string(),
107+
outPath.string(),
92108
executableTemplatesPath.string(),
93109
templatePrefix,
94110
templateName

source/globals.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
static constexpr std::string_view projectsFile = "projects.txt";
1515
static constexpr std::string_view editorPathsFile = "editorPaths.txt";
1616
static constexpr std::string_view templatePrefix = "com.unity.template";
17-
static constexpr std::string_view AppVersion = "v1.53";
17+
static constexpr std::string_view AppVersion = "v1.54";
1818

1919
struct wxListCtrl;
2020
struct wxWindow;

0 commit comments

Comments
 (0)