diff --git a/Greenshot/Forms/MainForm.cs b/Greenshot/Forms/MainForm.cs
index e219b8547..2648b1124 100644
--- a/Greenshot/Forms/MainForm.cs
+++ b/Greenshot/Forms/MainForm.cs
@@ -145,7 +145,7 @@ namespace Greenshot {
helpOutput.AppendLine();
helpOutput.AppendLine();
helpOutput.AppendLine("\t/language [language code]");
- helpOutput.AppendLine("\t\tSet the language of Greenshot, e.g. greenshot /language en-EN.");
+ helpOutput.AppendLine("\t\tSet the language of Greenshot, e.g. greenshot /language en-US.");
helpOutput.AppendLine();
helpOutput.AppendLine();
helpOutput.AppendLine("\t[filename]");
diff --git a/GreenshotPlugin/Core/CoreConfiguration.cs b/GreenshotPlugin/Core/CoreConfiguration.cs
index eff6d859a..19722e145 100644
--- a/GreenshotPlugin/Core/CoreConfiguration.cs
+++ b/GreenshotPlugin/Core/CoreConfiguration.cs
@@ -50,7 +50,7 @@ namespace GreenshotPlugin.Core {
///
[IniSection("Core", Description="Greenshot core configuration")]
public class CoreConfiguration : IniSection {
- [IniProperty("Language", Description="The language in IETF format (e.g. en-EN)")]
+ [IniProperty("Language", Description="The language in IETF format (e.g. en-US)")]
public string Language;
[IniProperty("RegionHotkey", Description="Hotkey for starting the region capture", DefaultValue="PrintScreen")]
diff --git a/GreenshotPlugin/Core/LogHelper.cs b/GreenshotPlugin/Core/LogHelper.cs
index dd36894a5..873b2e378 100644
--- a/GreenshotPlugin/Core/LogHelper.cs
+++ b/GreenshotPlugin/Core/LogHelper.cs
@@ -23,6 +23,7 @@ using System.IO;
using System.Reflection;
using System.Windows.Forms;
+using IniFile;
using log4net;
using log4net.Appender;
using log4net.Config;
@@ -58,6 +59,7 @@ namespace GreenshotPlugin.Core {
using (Stream stream = assem.GetManifestResourceStream("GreenshotPlugin.log4net-embedded.xml")) {
XmlConfigurator.Configure(stream);
isLog4NetConfigured = true;
+ IniConfig.ForceIniInStartupPath();
}
} catch {}
}
diff --git a/GreenshotPlugin/IniFile/IniConfig.cs b/GreenshotPlugin/IniFile/IniConfig.cs
index 6764bf926..20b31450f 100644
--- a/GreenshotPlugin/IniFile/IniConfig.cs
+++ b/GreenshotPlugin/IniFile/IniConfig.cs
@@ -48,6 +48,7 @@ namespace IniFile {
return portable;
}
}
+
///
/// Initialize the ini config
///
@@ -59,7 +60,25 @@ namespace IniFile {
Reload();
WatchConfigFile(true);
}
-
+
+ public static void ForceIniInStartupPath() {
+ if (portableCheckMade) {
+ throw new Exception("ForceLocal should be called before any file is read");
+ }
+ portable = false;
+ portableCheckMade = true;
+ string applicationStartupPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
+ if (applicationName == null || configName == null) {
+ Init();
+ }
+ string forcedIni = Path.Combine(applicationStartupPath, applicationName + INI_EXTENSION);
+ if (!File.Exists(forcedIni)) {
+ using (File.Create(forcedIni)) {
+
+ }
+ }
+ }
+
///
/// Default init
///
@@ -87,7 +106,7 @@ namespace IniFile {
// Monitor the ini file
watcher = new FileSystemWatcher();
watcher.Path = Path.GetDirectoryName(iniLocation);
- watcher.Filter = "*.ini";
+ watcher.Filter = "greenshot.ini";
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.Changed += new FileSystemEventHandler(ConfigFileChanged);
}
@@ -158,7 +177,9 @@ namespace IniFile {
if (portable) {
string pafConfigPath = Path.Combine(applicationStartupPath, @"Data\Settings");
try {
- Directory.CreateDirectory(pafConfigPath);
+ if (!Directory.Exists(pafConfigPath)) {
+ Directory.CreateDirectory(pafConfigPath);
+ }
iniFilePath = Path.Combine(pafConfigPath, configFilename);
} catch(Exception e) {
LOG.InfoFormat("Portable mode NOT possible, couldn't create directory '{0}'! Reason: {1}", pafConfigPath, e.Message);