예제 #1
0
    private void _on_FileDialog_dir_selected(String _dir)
    {
        //if directory is selected, update storage path.
        storagePath           = _dir;
        dataPathLineEdit.Text = _dir;

        //update ingredient and volume path
        IngredientPath = $"{storagePath}/{ingredientFile}";
        VolumePath     = $"{storagePath}/{volumeFile}";
        ReceiptPath    = $"{storagePath}/{receiptFile}";

        //update configuration
        updateConfiguration();

        //check if any ingredient, volume and receipt list file exist and copy them over to the new location
        var _file      = new Godot.File();
        var _directory = new Godot.Directory();

        if (_file.FileExists($"data/{volumeFile}"))
        {
            _directory.Copy($"data/{volumeFile}", VolumePath);
        }
        if (_file.FileExists($"data/{ingredientFile}"))
        {
            _directory.Copy($"data/{ingredientFile}", IngredientPath);
        }
        if (_file.FileExists($"data/{receiptFile}"))
        {
            _directory.Copy($"data/{receiptFile}", ReceiptPath);
        }
    }