0

Okay, so me and several others are trying to move a bunch of files from a game launcher. To said directory of your choice.

The problem is, the files wont move.

The way the launcher works, is you click install on the game, it installs a bunch of files to the location of your choice. But the files wont move.

Here' the code.

    private void MoveFolders()
    {
        string sourceDir = Config.GetGamePath();
        string destinationDir = textBoxFolder.Text;
        try
        {
            if (Directory.Exists(sourceDir) == true)
            {
                if (bGameIsInstalled == true && textBoxFolder.TextLength > 0)
                {
                    Directory.Move(sourceDir, destinationDir);
                    bMoveFolders = true;
                }
                else
                {

                    MessageBox.Show("Select Arma 3 directory before starting game");
                }
            }
            else
            {
                // Do somthing about source directory not existing - 
            }
        }
        catch (Exception ex)
        {
            //TODO: Handle the execption that has been thrown will do this on launcher update
        }
    }
  • Maybe some exception is thrown? –  Apr 01 '15 at 06:49
  • 1
    We wont debug your code, when you have gone and done that, you will find that either the source/destination string is not what you want. Or it will throw an error (permissions?) and we can go from there. – Mathemats Apr 01 '15 at 06:51
  • Can you provide samples for `sourceDir` and `destinationDir` (do they have same volume/drive letter)? – Ulugbek Umirov Apr 01 '15 at 06:51
  • see this : [Moving a folder (Directory) from one location to another] http://stackoverflow.com/a/2553245/4736873 this may help you – Eqbal Sohrabi Apr 01 '15 at 06:54

1 Answers1

0

You can use CopyFile. As you said this should be a installer, i wouldn't move them folders to another direction. Just copy it, because you can't use the installer one more time after all these files needed are moved away. And if you debug it, please just don't use try and catch. Test your code simply.

Community
  • 1
  • 1
Jonas Aisch
  • 71
  • 10