Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 2748925

Browse files
author
Dadoum
committed
Edit some files to make AppImage actually usable
1 parent d81ccb2 commit 2748925

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

Source/iCode/GUI/NewProjectWindow.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.IO;
34
using System.Linq;
45
using System.Reflection;
@@ -64,6 +65,9 @@ protected NewProjectWindow(Builder builder, IntPtr handle) : base(handle)
6465

6566
Console.WriteLine(_iconView.PathIsSelected(((ListStore)_iconView.Model).GetPath(temp)).ToString());
6667
SelectedTemplatePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "tools/templates/" + ((string) ((ListStore)_iconView.Model).GetValue(temp, 1)) + ".zip");
68+
if (!File.Exists(SelectedTemplatePath))
69+
SelectedTemplatePath = System.IO.Path.Combine(Program.UserDefinedTemplatesPath, ((string) ((ListStore)_iconView.Model).GetValue(temp, 1)) + ".zip");
70+
6771
Console.WriteLine(SelectedTemplatePath);
6872
Respond(ResponseType.Ok);
6973
this.Dispose();
@@ -85,11 +89,19 @@ protected NewProjectWindow(Builder builder, IntPtr handle) : base(handle)
8589

8690
_iconView.SelectionMode = SelectionMode.Single;
8791

92+
List<string> templates = new List<string>();
8893
foreach (var file in from f in Directory.GetFiles(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "tools/templates/")) where f.EndsWith(".zip", StringComparison.CurrentCultureIgnoreCase) select f)
8994
{
9095
store.AppendValues(IconLoader.LoadIcon(this, "gtk-file", IconSize.Dialog), System.IO.Path.GetFileNameWithoutExtension(file));
96+
templates.Add(System.IO.Path.GetFileNameWithoutExtension(file));
9197
}
9298

99+
foreach (var file in from f in Directory.GetFiles(Program.UserDefinedTemplatesPath) where f.EndsWith(".zip", StringComparison.CurrentCultureIgnoreCase) select f)
100+
{
101+
if (!templates.Contains(System.IO.Path.GetFileNameWithoutExtension(file)))
102+
store.AppendValues(IconLoader.LoadIcon(this, "gtk-file", IconSize.Dialog), System.IO.Path.GetFileNameWithoutExtension(file));
103+
}
104+
93105
store.SetSortColumnId(2, SortType.Ascending);
94106

95107
_iconView.Model = store;

Source/iCode/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public static void Main(string[] args)
1818
Console.WriteLine("Initialized output.");
1919
try
2020
{
21+
Directory.CreateDirectory(UserDefinedTemplatesPath);
2122
Log.SetDefaultHandler(new LogFunc((domain, level, message) =>
2223
{
2324
if (level != LogLevelFlags.Error && level != LogLevelFlags.FlagFatal)
@@ -42,6 +43,9 @@ public static void Main(string[] args)
4243
}
4344

4445
public static readonly string ConfigPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "iCode/");
46+
public static readonly string SDKPath = System.IO.Path.Combine(Program.ConfigPath, "SDK/");
47+
public static readonly string DeveloperPath = System.IO.Path.Combine(Program.ConfigPath, "developer/");
48+
public static readonly string UserDefinedTemplatesPath = System.IO.Path.Combine(Program.ConfigPath, "templates/");
4549

4650
public static MainWindow WinInstance;
4751
}

Source/iCode/Projects/ProjectManager.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ private static void FormatFiles(string path, string name, string prefix, string
253253

254254
public static bool BuildProject()
255255
{
256+
if (!Directory.Exists(Program.SDKPath) || !Directory.EnumerateFileSystemEntries(Program.SDKPath).Any())
257+
{
258+
Extensions.ShowMessage(MessageType.Error, "Cannot build application", "SDK path is empty, add SDK to " + Program.SDKPath);
259+
return false;
260+
}
261+
256262
var cachedir = Path.Combine(Project.Path, ".icode");
257263

258264
if (Directory.Exists(cachedir))
@@ -304,9 +310,10 @@ public static bool BuildProject()
304310

305311
public static bool SignIpa(string path)
306312
{
307-
if (!File.Exists(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "tools/developer/key.pem")))
313+
if (!File.Exists(Path.Combine(Program.DeveloperPath, "key.pem")))
308314
{
309-
Extensions.ShowMessage(MessageType.Error, "Cannot codesign application", "No certificate found in ./tools/developer/.\nRead README for information about how to place them,\n and run ./tools/helper/gen-certs to generate certificates.\n The syntax is:\ngen-certs apple-id app-only-password device-udid \nNote: the device udid i can be automatically retrieved\n if your device is connected to the computer and\n if you trusted the computer.");
315+
File.Copy(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "tools/developer/readme"), Path.Combine(Program.DeveloperPath, "readme"), true);
316+
Extensions.ShowMessage(MessageType.Error, "Cannot codesign application", "No certificate found in " + Program.DeveloperPath + ".\nRead README for information about how to place them.");
310317
return false;
311318
}
312319

0 commit comments

Comments
 (0)