From bb9ba7db52d8bc0c340c524746ed8e4f26cc869c Mon Sep 17 00:00:00 2001 From: surtur Date: Sun, 18 Oct 2020 14:11:22 +0200 Subject: [PATCH] fix: path magic --- main_form.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main_form.cs b/main_form.cs index 46259cd..60b8006 100644 --- a/main_form.cs +++ b/main_form.cs @@ -225,7 +225,7 @@ namespace KRY_0x02 { /* * Wrap the creation of the OpenFileDialog instance in a using statement, - * rather than manually calling the Dispose method to ensure proper disposal + * rather than manually calling the Dispose method to ensure proper disposal */ using (OpenFileDialog dlg = new OpenFileDialog()) @@ -258,7 +258,12 @@ namespace KRY_0x02 private void button5_Click(object sender, EventArgs e) { /*/* use-default-pic button */ - string filename = @"C:\Users\citizen\source\repos\KRY-0x02\security.png"; + string wd = Environment.CurrentDirectory; + Console.WriteLine("* [debug] working directory: " + wd); + string projectDirectory = Directory.GetParent(wd).Parent.FullName; + Console.WriteLine("* [debug] project directory: " + projectDirectory); + string filename = projectDirectory + @"/security.png"; + Console.WriteLine("* [debug] filename: " + filename); pictureBox1.Image = new Bitmap(filename); pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; textBoxsizemode.Text = "auto";