Copying File Error (not working)
Hello ! I was doing an app with Microsoft visual studio 2022 and i wanted to copy an exe to file but it's not working. I dont know how to fix it
public void run()
{
foreach(string i in Directory.GetDirectories("C:\\Users\\" + Environment.UserName + "\\appdata\\roaming"))
{
if (i == "C:\\Users\\" + Environment.UserName + "\\appdata\\roaming\\FplProject_IDE")
{
if_dir_in_path = true;
break;
}
else
{
if_dir_in_path = false;
break;
}
}
if (!if_dir_in_path)
{
Directory.CreateDirectory("C:\\Users\\" + Environment.UserName + "\\appdata\\roaming\\FplProject_IDE");
try
{
File.Copy(Directory.GetCurrentDirectory() + "\\French_Programming_Language.exe", "C:\\Users\\" + Environment.UserName + "\\appdata\\roaming\\FplProject_IDE\\French_Programming_Language.exe", true);
}
catch (IOException iox)
{
MessageBox(new IntPtr(0), Convert.ToString(iox), "Error", 0);
}
}public void run()
{
foreach(string i in Directory.GetDirectories("C:\\Users\\" + Environment.UserName + "\\appdata\\roaming"))
{
if (i == "C:\\Users\\" + Environment.UserName + "\\appdata\\roaming\\FplProject_IDE")
{
if_dir_in_path = true;
break;
}
else
{
if_dir_in_path = false;
break;
}
}
if (!if_dir_in_path)
{
Directory.CreateDirectory("C:\\Users\\" + Environment.UserName + "\\appdata\\roaming\\FplProject_IDE");
try
{
File.Copy(Directory.GetCurrentDirectory() + "\\French_Programming_Language.exe", "C:\\Users\\" + Environment.UserName + "\\appdata\\roaming\\FplProject_IDE\\French_Programming_Language.exe", true);
}
catch (IOException iox)
{
MessageBox(new IntPtr(0), Convert.ToString(iox), "Error", 0);
}
}