Skip to content

Commit

Permalink
Fix running from installed file and installer
Browse files Browse the repository at this point in the history
Installer missed out profiles/ also ensure that if profiles is missing
an error message is displayed
  • Loading branch information
robincornelius committed Feb 4, 2017
1 parent 8674986 commit d300dd9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
/libEDSsharp/bin/Release
/.vs/EDSTest/v14/*.suo
/.vs/EDSEditor/v14/*.suo
edseditor-Setup.exe
62 changes: 35 additions & 27 deletions EDSTest/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,42 +61,50 @@ private void loadprofiles()
// load user profiles from the My Documents\.edseditor\profiles\ folder
// Personal is my documents in windows and ~ in mono

List<string> profilelist = Directory.GetFiles(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + "Profiles").ToList();
string homepath = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".edseditor");
homepath = Path.Combine(homepath, "profiles");

if (Directory.Exists(homepath))
try
{
profilelist.AddRange(Directory.GetFiles(homepath).ToList());
}

int count = 0;
//some attempt to validate files
List<string> profilelist = Directory.GetFiles(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + "Profiles").ToList();
string homepath = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".edseditor");
homepath = Path.Combine(homepath, "profiles");

foreach (string file in profilelist)
{
if (Path.GetExtension(file) == ".xml")
count++;
}
if (Directory.Exists(homepath))
{
profilelist.AddRange(Directory.GetFiles(homepath).ToList());
}

int count = 0;
//some attempt to validate files

foreach (string file in profilelist)
{
if (Path.GetExtension(file) == ".xml")
count++;
}


ToolStripMenuItem[] items = new ToolStripMenuItem[count];
ToolStripMenuItem[] items = new ToolStripMenuItem[count];

int x = 0;
foreach(string file in profilelist)
{
if (Path.GetExtension(file) == ".xml")
int x = 0;
foreach (string file in profilelist)
{
ToolStripMenuItem i = new ToolStripMenuItem();
i.Name = Path.GetFileName(file);
i.Text = Path.GetFileName(file);
i.Click += ProfileAddClick;
i.Image = Properties.Resources.InsertColumn_5626;
items[x++] = i;
if (Path.GetExtension(file) == ".xml")
{
ToolStripMenuItem i = new ToolStripMenuItem();
i.Name = Path.GetFileName(file);
i.Text = Path.GetFileName(file);
i.Click += ProfileAddClick;
i.Image = Properties.Resources.InsertColumn_5626;
items[x++] = i;
}
}
}

insertToolStripMenuItem.DropDownItems.AddRange(items);
insertToolStripMenuItem.DropDownItems.AddRange(items);
}
catch (Exception e)
{
MessageBox.Show("Loading profiles has failed for the following reason :\n" + e.ToString());
}

}

Expand Down
5 changes: 5 additions & 0 deletions setup.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ Section "OpenEdsEditor" Secopeneds ;No components page, name is not important
File EDSTest\bin\Release\style.css
File Index_8287_16x.ico
File License-GPLv3.txt

SetOutPath $INSTDIR\Profiles
File EDSTest\Profiles\*

SetShellVarContext all
CreateDirectory "$SMPROGRAMS\OpenEDSEditor"
Expand Down Expand Up @@ -102,6 +105,8 @@ Section "Uninstall"
;ADD YOUR OWN FILES HERE...

Delete "$INSTDIR\*"
Delete "$INSTDIR\Profiles\*"
RMDir "$INSTDIR\Profiles"
RMDir "$INSTDIR"

SetShellVarContext all
Expand Down

0 comments on commit d300dd9

Please sign in to comment.