diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 0dafb8ff9..23be35ce4 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1418,23 +1418,23 @@ void CFileBrowser::paintHead() free(l_name); } -bool chooserDir(char *setting_dir, bool test_dir, const char *action_str, size_t str_leng) +bool chooserDir(char *setting_dir, bool test_dir, const char *action_str, size_t str_leng, bool allow_tmp) { std::string tmp_setting_dir = setting_dir; - if(chooserDir(tmp_setting_dir, test_dir, action_str)){ + if(chooserDir(tmp_setting_dir, test_dir, action_str,allow_tmp)){ strncpy(setting_dir,tmp_setting_dir.c_str(), str_leng); return true; } return false; } -bool chooserDir(std::string &setting_dir, bool test_dir, const char *action_str) +bool chooserDir(std::string &setting_dir, bool test_dir, const char *action_str, bool allow_tmp) { const char *wrong_str = "Wrong/unsupported"; CFileBrowser b; b.Dir_Mode=true; if (b.exec(setting_dir.c_str())) { const char * newdir = b.getSelectedFile()->Name.c_str(); - if(test_dir && check_dir(newdir)){ + if(test_dir && check_dir(newdir,allow_tmp)){ printf("%s %s dir %s\n",wrong_str ,action_str, newdir); return false; }else { diff --git a/src/gui/filebrowser.h b/src/gui/filebrowser.h index 43ecc81ad..c209b4df0 100644 --- a/src/gui/filebrowser.h +++ b/src/gui/filebrowser.h @@ -56,8 +56,8 @@ #define ENABLE_INTERNETRADIO #define VLC_URI "vlc://" -bool chooserDir(std::string &setting_dir, bool test_dir, const char *action_str); -bool chooserDir(char *setting_dir, bool test_dir, const char *action_str, size_t str_leng); +bool chooserDir(std::string &setting_dir, bool test_dir, const char *action_str, bool allow_tmp = false); +bool chooserDir(char *setting_dir, bool test_dir, const char *action_str, size_t str_leng, bool allow_tmp = false); /** * Converts input of numeric keys to SMS style char input. diff --git a/src/gui/update_settings.cpp b/src/gui/update_settings.cpp index c2ae697f1..d53cc7af7 100644 --- a/src/gui/update_settings.cpp +++ b/src/gui/update_settings.cpp @@ -93,7 +93,7 @@ int CUpdateSettings::exec(CMenuTarget* parent, const std::string &actionKey) if(actionKey == "update_dir") { const char *action_str = "update"; - if(chooserDir(g_settings.update_dir, true, action_str, sizeof(g_settings.update_dir)-1)) + if(chooserDir(g_settings.update_dir, true, action_str, sizeof(g_settings.update_dir)-1,true)) printf("[neutrino] new %s dir %s\n", action_str, g_settings.update_dir); return res; diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index d084d1c8a..892ab64bb 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -206,7 +206,7 @@ int safe_mkdir(char * path) } /* function used to check is this dir writable, i.e. not flash, for record etc */ -int check_dir(const char * dir) +int check_dir(const char * dir, bool allow_tmp) { /* default to return, if statfs fail */ int ret = -1; @@ -223,12 +223,16 @@ int check_dir(const char * dir) case 0x58465342L: /*xfs*/ case 0x4d44L: /*msdos*/ case 0x0187: /* AUTOFS_SUPER_MAGIC */ - case 0x858458f6L: /*ramfs*/ #if 0 case 0x72b6L: /*jffs2*/ #endif - ret = 0; - break; //ok + ret = 0;//ok + break; + case 0x858458f6L: /*ramfs*/ + case 0x1021994: /*TMPFS_MAGIC*/ + if(allow_tmp) + ret = 0;//ok + break; default: fprintf(stderr, "%s Unknown filesystem type: 0x%x\n", dir, (int)s.f_type); break; // error diff --git a/src/system/helpers.h b/src/system/helpers.h index bab8204eb..a146e8713 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -32,7 +32,7 @@ int safe_mkdir(char * path); off_t file_size(const char *filename); bool file_exists(const char *filename); void wakeup_hdd(const char *hdd_dir); -int check_dir(const char * dir); +int check_dir(const char * dir, bool allow_tmp = false); bool get_fs_usage(const char * dir, long &total, long &used, long *bsize=NULL); bool get_mem_usage(unsigned long &total, unsigned long &free);