diff --git a/ModPacker.Designer.cs b/ModPacker.Designer.cs index fa0dbb5..77eb183 100644 --- a/ModPacker.Designer.cs +++ b/ModPacker.Designer.cs @@ -261,6 +261,8 @@ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(331, 297); + this.MinimumSize = new System.Drawing.Size(331, 297); this.Name = "ModPacker"; this.Text = "AM2R ModPacker"; this.panel1.ResumeLayout(false); diff --git a/ModPacker.cs b/ModPacker.cs index e2ed4fe..18cbe01 100644 --- a/ModPacker.cs +++ b/ModPacker.cs @@ -92,11 +92,27 @@ namespace AM2R_ModPacker } // Create temp work folders - // string tempFolder = Directory.CreateDirectory(localPath + "\\temp").FullName; - string tempFolder = Directory.CreateDirectory(Path.GetTempPath() + "\\AM2RModPacker").FullName; - string tempOriginal = Directory.CreateDirectory(tempFolder + "\\original").FullName; - string tempMod = Directory.CreateDirectory(tempFolder + "\\mod").FullName; - string tempProfile = Directory.CreateDirectory(tempFolder + "\\profile").FullName; + string tempFolder = "", + tempOriginal = "", + tempMod = "", + tempProfile = ""; + + // We might not have permission to access to the temp directory, so we need to catch the exception. + try + { + tempFolder = Directory.CreateDirectory(Path.GetTempPath() + "\\AM2RModPacker").FullName; + tempOriginal = Directory.CreateDirectory(tempFolder + "\\original").FullName; + tempMod = Directory.CreateDirectory(tempFolder + "\\mod").FullName; + tempProfile = Directory.CreateDirectory(tempFolder + "\\profile").FullName; + } + catch (System.Security.SecurityException) + { + MessageBox.Show("Could not create temp directory! Please run the application with administrator rights.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + + AbortPatch(); + + return; + } // Extract 1.1 and modded AM2R to their own directories in temp work ZipFile.ExtractToDirectory(originalLocation, tempOriginal);