Small fixes that make it possible to run the not installed Greenshot from a network share.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1616 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-02-01 11:58:59 +00:00
commit fddeb05d67
4 changed files with 25 additions and 10 deletions

View file

@ -81,10 +81,10 @@ namespace IniFile {
/// Default init
/// </summary>
public static void Init() {
AssemblyProductAttribute[] assemblyProductAttributes = Assembly.GetCallingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false) as AssemblyProductAttribute[];
AssemblyProductAttribute[] assemblyProductAttributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false) as AssemblyProductAttribute[];
if (assemblyProductAttributes.Length > 0) {
string productName = assemblyProductAttributes[0].Product;
LOG.DebugFormat("Using ProductName {0}", productName);
LOG.InfoFormat("Using ProductName {0}", productName);
Init(productName, productName);
} else {
throw new InvalidOperationException("Assembly ProductName not set.");
@ -160,7 +160,13 @@ namespace IniFile {
throw new InvalidOperationException("IniConfig.Init not called!");
}
string iniFilePath = null;
string applicationStartupPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string applicationStartupPath = "";
try {
applicationStartupPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
} catch (Exception exception) {
LOG.WarnFormat("Problem retrieving the AssemblyLocation: {0}", exception.Message);
applicationStartupPath = @".";
}
string pafPath = Path.Combine(applicationStartupPath, @"App\" + applicationName);
if (portable || !portableCheckMade) {