title: wxCopyFile; "ERROR 5: Access is denied" even when running with administrator privilages
body: <p>I'm writing a very simple program which edits an XML file and copies a user specified image to the folder in which the .exe runs.</p>
  <p>The problem I'm having is with wxCopyFile. When I first ran the program (with debug mode in Visual Studio 2019) I got &quot;error 5: Access denied&quot;, so I tried running the .exe from the Debug folder. Again, I got the same error. Then I ran it as administrator and again I got the same error! After that, I copied the .exe at another folder, tried it with administrator privileges and once again, it didn't work!</p>
  <p>Here is the code where the program asks the user to select his desired image:</p>
  <pre><code>void GUI::OnSelectImg(wxCommandEvent&amp; event) {
      wxFileDialog* selectImage = new wxFileDialog(NULL,
          wxString(&quot;Select the country's flag...&quot;),
          wxEmptyString,
          wxEmptyString,
          wxT(&quot;PNG image files (*.png)|*.png&quot;) //Allow only pngs!
      );
  
      if (selectImage-&gt;ShowModal() == wxID_CANCEL) {
          delete selectImage;
          return;
      }
  
      fileMGR.SetImagePath(selectImage-&gt;GetPath());
      imagePathLabel-&gt;SetLabel(selectImage-&gt;GetPath()); //Updates the label
      delete selectImage;
  }
  </code></pre>
  <p>And the part with wxCopyFile</p>
  <pre><code>void GUI::OnAddCountry(wxCommandEvent&amp; event) {
      //Has he specified a flag?
      if (fileMGR.GetImagePath().IsEmpty()) {
          wxMessageBox(
              wxString(&quot;You have not specified an image for the country's flag!\nSpecify one and try again!&quot;),
              &quot;No image selected!&quot;,
              wxOK | wxICON_ERROR,
              this
          );
          return;
      }
  
      if (!wxCopyFile(fileMGR.GetImagePath(), wxStandardPaths::Get().GetDataDir())) {
          wxMessageBox(
              wxString(&quot;Failed to copy the selected image!&quot;),
              &quot;Failed to copy the image!&quot;,
              wxOK | wxICON_ERROR,
              this
          );
          return;
      }
  
      //Other not important actions...
  }
  </code></pre>
  <p>And here is also <a href="https://i.stack.imgur.com/K0exY.png" rel="nofollow noreferrer">the error window</a>. What I'm I doing wrong? Thanks in advance!</p>