[gparted] Enhance detection for ext3, fat16, fat32, linux-swap, and hfsplus
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Enhance detection for ext3, fat16, fat32, linux-swap, and hfsplus
- Date: Wed, 28 Apr 2010 20:12:15 +0000 (UTC)
commit 6369e58bff5d13941fe58c437ee83c0cf1f0d283
Author: Curtis Gedak <gedakc gmail com>
Date: Wed Apr 28 14:11:24 2010 -0600
Enhance detection for ext3, fat16, fat32, linux-swap, and hfsplus
This change is in preparation for supporting sectors sizes > 512 bytes.
src/FS_Info.cc | 17 ++++++++++++++---
src/GParted_Core.cc | 6 ++++--
2 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/src/FS_Info.cc b/src/FS_Info.cc
index 5b884f2..666fc9d 100644
--- a/src/FS_Info.cc
+++ b/src/FS_Info.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2009 Curtis Gedak
+/* Copyright (C) 2008, 2009, 2010 Curtis Gedak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -86,12 +86,23 @@ Glib::ustring FS_Info::get_device_entry( const Glib::ustring & path )
Glib::ustring FS_Info::get_fs_type( const Glib::ustring & path )
{
Glib::ustring fs_type = "" ;
+ Glib::ustring fs_sec_type = "" ;
//Retrieve the line containing the device path
- Glib::ustring temp = get_device_entry( path ) ;
+ Glib::ustring dev_path_line = get_device_entry( path ) ;
//Retrieve TYPE
- fs_type = Utils::regexp_label( temp, "TYPE=\"([^\"]*)\"" ) ;
+ fs_type = Utils::regexp_label( dev_path_line, "[^_]TYPE=\"([^\"]*)\"" ) ;
+ fs_sec_type = Utils::regexp_label( dev_path_line, "SEC_TYPE=\"([^\"]*)\"" ) ;
+
+ //If vfat, decide whether fat16 or fat32
+ if ( fs_type == "vfat" )
+ {
+ if ( fs_sec_type == "msdos" )
+ fs_type = "fat16" ;
+ else
+ fs_type = "fat32" ;
+ }
if ( fs_type .empty() && vol_id_found )
{
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 1886426..50b11fc 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -960,7 +960,8 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
fs_type == "linux-swap(v1)" ||
fs_type == "linux-swap(new)" ||
fs_type == "linux-swap(v0)" ||
- fs_type == "linux-swap(old)" )
+ fs_type == "linux-swap(old)" ||
+ fs_type == "swap" )
return GParted::FS_LINUX_SWAP ;
else if ( fs_type == "fat16" )
return GParted::FS_FAT16 ;
@@ -976,7 +977,8 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
return GParted::FS_JFS ;
else if ( fs_type == "hfs" )
return GParted::FS_HFS ;
- else if ( fs_type == "hfs+" )
+ else if ( fs_type == "hfs+" ||
+ fs_type == "hfsplus" )
return GParted::FS_HFSPLUS ;
else if ( fs_type == "ufs" )
return GParted::FS_UFS ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]