gkngkc / UnityStandaloneFileBrowser

A native file browser for unity standalone platforms
MIT License
2.01k stars 317 forks source link

StandaloneFileBrowser.SaveFilePanelAsync does use directory as defaultName #37

Open NoxMortem opened 5 years ago

NoxMortem commented 5 years ago

StandaloneFileBrowser.SaveFilePanelAsync(title,directory,defaultName) does actually open a filebrowser on windows with directory as defaultName in some random folder (likely the last saved position?)

In StandaloneFileBrowserWindows.SaveFilePanel

            if (!string.IsNullOrEmpty(directory))
            {
                finalFilename = GetDirectoryPath(directory);
            }

Should be

            if (!string.IsNullOrEmpty(directory))
            {
                finalFilename = GetDirectoryPath(directory);
                    if (Directory.Exists(finalFilename))
                    fd.InitialDirectory = finalFilename;
            }