public string ChangeDir(string path) { // Take data from a path // if problem occured, fill values empty if (path == null || path == "" || !Directory.Exists(path)) { loaded = false; cangoback = false; currentpath = ""; subfiles = new string[0]; subdirs = new string[0]; stringlist = null; } else { try { cangoback = Directory.GetParent(path) != null; currentpath = FileBrowser.ChangeDirectory(path); subfiles = FileBrowser.GetFiles(path); subdirs = FileBrowser.GetDirectories(path); stringlist = BuildStringArray(); loaded = true; } catch (Exception) { ChangeDir(null); } } return(currentpath); }
public void OnClick() { if (current_directory != null) { browser.ChangeDirectory(current_directory); } else if (current_file != null) { if (browser.validate_method(current_file)) { browser.current_file = current_file; browser.SelectedFileText.text = current_file.Name; } } }
public string TryChangeDir(string path) { // Take data from a path // if problem occured, keep the previous state if (path != null && path != "" || !Directory.Exists(path)) { try { bool tryCGB = Directory.GetParent(path) != null; string tryCP = FileBrowser.ChangeDirectory(path); string[] trySF = FileBrowser.GetFiles(path); string[] trySD = FileBrowser.GetDirectories(path); //If a problem accured, the values won't be assigned cangoback = tryCGB; currentpath = tryCP; subdirs = trySD; subfiles = trySF; loaded = true; stringlist = BuildStringArray(); } catch (Exception) {} } return(currentpath); }