-fix check dir

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1034 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
satbaby
2011-01-21 12:42:33 +00:00
parent 47752165ea
commit 4eac551479
4 changed files with 24 additions and 31 deletions

View File

@@ -1342,25 +1342,9 @@ void CInfoViewer::showSNR ()
BBarY + InfoHeightY_Info / 2 - 2 - 6, 100, 6, per, 100);
per = 0;
//HD info
if (::statfs(g_settings.network_nfs_recordingdir, &s) == 0) {
switch (s.f_type)
{
case (int) 0xEF53: /*EXT2 & EXT3*/
case (int) 0x6969: /*NFS*/
case (int) 0xFF534D42: /*CIFS*/
case (int) 0x517B: /*SMB*/
case (int) 0x52654973: /*REISERFS*/
case (int) 0x65735546: /*fuse for ntfs*/
case (int) 0x58465342: /*xfs*/
case (int) 0x4d44: /*msdos*/
per = (s.f_blocks - s.f_bfree) / (s.f_blocks/100);
break;
default:
fprintf( stderr,"%s Unknow File system type: %i\n",g_settings.network_nfs_recordingdir ,s.f_type);
break;
}
if(!check_dir(g_settings.network_nfs_recordingdir)){
per = (s.f_blocks - s.f_bfree) / (s.f_blocks/100);
}
hddscale->paintProgressBar(BoxEndX - (((g_settings.casystem_display !=2) ? 0:icon_crypt_width )+ icon_xres_width + 2*icon_large_width + 2*icon_small_width + ((g_settings.casystem_display !=2) ?5:6)*2) - 102,
BBarY + InfoHeightY_Info / 2 + 2, 100, 6, per, 100);
}

View File

@@ -160,12 +160,7 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
{
parent->hide();
int nr=atoi(actionKey.substr(3,1).c_str());
CFileBrowser b;
b.Dir_Mode=true;
if (b.exec(g_settings.network_nfs_local_dir[nr]))
strcpy(g_settings.network_nfs_local_dir[nr], b.getSelectedFile()->Name.c_str());
chooserDir(g_settings.network_nfs_local_dir[nr], false, NULL, sizeof(g_settings.network_nfs_local_dir[nr])-1);
returnval = menu_return::RETURN_REPAINT;
}
return returnval;

View File

@@ -1882,7 +1882,6 @@ bool CNeutrinoApp::doGuiRecord(char * preselectedDir, bool addTimer)
}
else if(preselectedDir == NULL && (g_settings.recording_choose_direct_rec_dir == 1)) {
int userDecision = -1;
CMountChooser recDirs(LOCALE_TIMERLIST_RECORDING_DIR,NEUTRINO_ICON_SETTINGS,&userDecision,NULL,g_settings.network_nfs_recordingdir);
if (recDirs.hasItem()) {
recDirs.exec(NULL,"");
@@ -4213,7 +4212,7 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey)
parent->hide();
const char *action_str = "plugin";
if(chooserDir(g_settings.plugin_hdd_dir, true, action_str)){
if(chooserDir(g_settings.plugin_hdd_dir, false, action_str)){
g_PluginList->loadPlugins();
}
@@ -4223,7 +4222,7 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey)
parent->hide();
const char *action_str = "logo";
chooserDir(g_settings.logo_hdd_dir, true, action_str);
chooserDir(g_settings.logo_hdd_dir, false, action_str);
return menu_return::RETURN_REPAINT;
}

View File

@@ -1108,11 +1108,26 @@ int safe_mkdir(char * path)
int check_dir(const char * newdir)
{
if(strncmp(newdir, "/media/sda1/", 12) && strncmp(newdir, "/media/sdb1/", 12) && strncmp(newdir, "/mnt/", 5) && strncmp(newdir, "/tmp/", 5) && strncmp(newdir, "/media/", 7)) {
return 1;
struct statfs s;
if (::statfs(newdir, &s) == 0) {
switch (s.f_type) /* f_type is long */
{
case 0xEF53L: /*EXT2 & EXT3*/
case 0x6969L: /*NFS*/
case 0xFF534D42L: /*CIFS*/
case 0x517BL: /*SMB*/
case 0x52654973L: /*REISERFS*/
case 0x65735546L: /*fuse for ntfs*/
case 0x58465342L: /*xfs*/
case 0x4d44L: /*msdos*/
return 0;//ok
default:
fprintf( stderr,"%s Unknow File system type: %i\n",newdir ,s.f_type);
break;
}
}
return 0;
return 1;//error
}