diff --git a/src/GitHub.Api/Application/ApplicationManagerBase.cs b/src/GitHub.Api/Application/ApplicationManagerBase.cs
index 219aec2d5..34c2fa9bc 100644
--- a/src/GitHub.Api/Application/ApplicationManagerBase.cs
+++ b/src/GitHub.Api/Application/ApplicationManagerBase.cs
@@ -107,8 +107,8 @@ public ITask InitializeRepository()
.Then(GitClient.LfsInstall())
.ThenInUI(SetProjectToTextSerialization)
.Then(new ActionTask(CancellationToken, _ => {
- AssemblyResources.ToFile(ResourceType.Generic, ".gitignore", targetPath);
- AssemblyResources.ToFile(ResourceType.Generic, ".gitattributes", targetPath);
+ AssemblyResources.ToFile(ResourceType.Generic, ".gitignore", targetPath, Environment);
+ AssemblyResources.ToFile(ResourceType.Generic, ".gitattributes", targetPath, Environment);
assetsGitignore.CreateFile();
}))
diff --git a/src/GitHub.Api/GitHub.Api.csproj b/src/GitHub.Api/GitHub.Api.csproj
index 874e7467e..995e310dd 100644
--- a/src/GitHub.Api/GitHub.Api.csproj
+++ b/src/GitHub.Api/GitHub.Api.csproj
@@ -239,6 +239,9 @@
Metrics\MetricsService.cs
+
+ Properties\ApplicationInfo_Local.cs
+
diff --git a/src/GitHub.Api/Helpers/AssemblyResources.cs b/src/GitHub.Api/Helpers/AssemblyResources.cs
index c00c57cb2..28303eca8 100644
--- a/src/GitHub.Api/Helpers/AssemblyResources.cs
+++ b/src/GitHub.Api/Helpers/AssemblyResources.cs
@@ -12,7 +12,7 @@ enum ResourceType
class AssemblyResources
{
- public static NPath ToFile(ResourceType resourceType, string resource, NPath destinationPath)
+ public static NPath ToFile(ResourceType resourceType, string resource, NPath destinationPath, IEnvironment environment)
{
var os = "";
if (resourceType == ResourceType.Platform)
@@ -21,7 +21,7 @@ public static NPath ToFile(ResourceType resourceType, string resource, NPath des
: DefaultEnvironment.OnLinux ? "linux"
: "mac";
}
- var type = resourceType == ResourceType.Icon ? "Icons"
+ var type = resourceType == ResourceType.Icon ? "IconsAndLogos"
: resourceType == ResourceType.Platform ? "PlatformResources"
: "Resources";
var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(
@@ -29,7 +29,7 @@ public static NPath ToFile(ResourceType resourceType, string resource, NPath des
if (stream != null)
return destinationPath.Combine(resource).WriteAllBytes(stream.ToByteArray());
- return new NPath(type).Combine(os, resource);
+ return environment.ExtensionInstallPath.Combine(type, os, resource);
}
}
}
\ No newline at end of file
diff --git a/src/GitHub.Api/Installer/GitInstaller.cs b/src/GitHub.Api/Installer/GitInstaller.cs
index d122f5cf8..414433c39 100644
--- a/src/GitHub.Api/Installer/GitInstaller.cs
+++ b/src/GitHub.Api/Installer/GitInstaller.cs
@@ -163,7 +163,7 @@ public Task SetupGitIfNeeded(NPath tempPath, IProgress zipFileProgr
cancellationToken.ThrowIfCancellationRequested();
- var archiveFilePath = AssemblyResources.ToFile(ResourceType.Platform, GitZipFile, tempPath);
+ var archiveFilePath = AssemblyResources.ToFile(ResourceType.Platform, GitZipFile, tempPath, environment);
if (!archiveFilePath.FileExists())
{
logger.Warning("Archive \"{0}\" missing", archiveFilePath.ToString());
@@ -228,7 +228,7 @@ public Task SetupGitLfsIfNeeded(NPath tempPath, IProgress zipFilePr
cancellationToken.ThrowIfCancellationRequested();
- var archiveFilePath = AssemblyResources.ToFile(ResourceType.Platform, GitLfsZipFile, tempPath);
+ var archiveFilePath = AssemblyResources.ToFile(ResourceType.Platform, GitLfsZipFile, tempPath, environment);
if (!archiveFilePath.FileExists())
{
logger.Warning("Archive \"{0}\" missing", archiveFilePath.ToString());
diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs
index 5c21eee56..5239a77be 100644
--- a/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs
+++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs
@@ -50,7 +50,7 @@ public IEnvironment Environment
{
unityAssetsPath = Application.dataPath;
unityApplication = EditorApplication.applicationPath;
- extensionInstallPath = AssetDatabase.GetAssetPath(this);
+ extensionInstallPath = DetermineInstallationPath();
unityVersion = Application.unityVersion;
}
environment.Initialize(unityVersion, extensionInstallPath.ToNPath(), unityApplication.ToNPath(), unityAssetsPath.ToNPath());
@@ -62,6 +62,16 @@ public IEnvironment Environment
}
}
+ private NPath DetermineInstallationPath()
+ {
+ // Juggling to find out where we got installed
+ var shim = ScriptableObject.CreateInstance();
+ var script = MonoScript.FromScriptableObject(shim);
+ var scriptPath = AssetDatabase.GetAssetPath(script).ToNPath();
+ ScriptableObject.DestroyImmediate(shim);
+ return scriptPath.Parent;
+ }
+
public void Flush()
{
repositoryPath = Environment.RepositoryPath;
diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/AuthenticationWindow.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/AuthenticationWindow.cs
index e67c0662f..2b11f5b40 100644
--- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/AuthenticationWindow.cs
+++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/AuthenticationWindow.cs
@@ -29,6 +29,10 @@ public static IView Open(Action onClose = null)
public override void OnGUI()
{
+ if (authView == null)
+ {
+ CreateViews();
+ }
authView.OnGUI();
}