mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1063126 - DeviceStorage - Add some logging. r=khuey
This commit is contained in:
parent
72ffa9c717
commit
a005dd1fc0
@ -871,13 +871,17 @@ DeviceStorageFile::GetRootDirectoryForType(const nsAString& aStorageType,
|
||||
InitDirs();
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
nsresult rv;
|
||||
nsString volMountPoint;
|
||||
if (DeviceStorageTypeChecker::IsVolumeBased(aStorageType)) {
|
||||
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(vs);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIVolume> vol;
|
||||
rv = vs->GetVolumeByName(aStorageName, getter_AddRefs(vol));
|
||||
if(NS_FAILED(rv)) {
|
||||
printf_stderr("##### DeviceStorage: GetVolumeByName('%s') failed\n",
|
||||
NS_LossyConvertUTF16toASCII(aStorageName).get());
|
||||
}
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
vol->GetMountPoint(volMountPoint);
|
||||
}
|
||||
@ -886,7 +890,12 @@ DeviceStorageFile::GetRootDirectoryForType(const nsAString& aStorageType,
|
||||
// Picture directory
|
||||
if (aStorageType.EqualsLiteral(DEVICESTORAGE_PICTURES)) {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
NS_NewLocalFile(volMountPoint, false, getter_AddRefs(f));
|
||||
rv = NS_NewLocalFile(volMountPoint, false, getter_AddRefs(f));
|
||||
if(NS_FAILED(rv)) {
|
||||
printf_stderr("##### DeviceStorage: NS_NewLocalFile failed StorageType: '%s' path '%s'\n",
|
||||
NS_LossyConvertUTF16toASCII(volMountPoint).get(),
|
||||
NS_LossyConvertUTF16toASCII(aStorageType).get());
|
||||
}
|
||||
#else
|
||||
f = sDirs->pictures;
|
||||
#endif
|
||||
@ -895,7 +904,12 @@ DeviceStorageFile::GetRootDirectoryForType(const nsAString& aStorageType,
|
||||
// Video directory
|
||||
else if (aStorageType.EqualsLiteral(DEVICESTORAGE_VIDEOS)) {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
NS_NewLocalFile(volMountPoint, false, getter_AddRefs(f));
|
||||
rv = NS_NewLocalFile(volMountPoint, false, getter_AddRefs(f));
|
||||
if(NS_FAILED(rv)) {
|
||||
printf_stderr("##### DeviceStorage: NS_NewLocalFile failed StorageType: '%s' path '%s'\n",
|
||||
NS_LossyConvertUTF16toASCII(volMountPoint).get(),
|
||||
NS_LossyConvertUTF16toASCII(aStorageType).get());
|
||||
}
|
||||
#else
|
||||
f = sDirs->videos;
|
||||
#endif
|
||||
@ -904,7 +918,12 @@ DeviceStorageFile::GetRootDirectoryForType(const nsAString& aStorageType,
|
||||
// Music directory
|
||||
else if (aStorageType.EqualsLiteral(DEVICESTORAGE_MUSIC)) {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
NS_NewLocalFile(volMountPoint, false, getter_AddRefs(f));
|
||||
rv = NS_NewLocalFile(volMountPoint, false, getter_AddRefs(f));
|
||||
if(NS_FAILED(rv)) {
|
||||
printf_stderr("##### DeviceStorage: NS_NewLocalFile failed StorageType: '%s' path '%s'\n",
|
||||
NS_LossyConvertUTF16toASCII(volMountPoint).get(),
|
||||
NS_LossyConvertUTF16toASCII(aStorageType).get());
|
||||
}
|
||||
#else
|
||||
f = sDirs->music;
|
||||
#endif
|
||||
@ -919,7 +938,12 @@ DeviceStorageFile::GetRootDirectoryForType(const nsAString& aStorageType,
|
||||
// default SDCard
|
||||
else if (aStorageType.EqualsLiteral(DEVICESTORAGE_SDCARD)) {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
NS_NewLocalFile(volMountPoint, false, getter_AddRefs(f));
|
||||
rv = NS_NewLocalFile(volMountPoint, false, getter_AddRefs(f));
|
||||
if(NS_FAILED(rv)) {
|
||||
printf_stderr("##### DeviceStorage: NS_NewLocalFile failed StorageType: '%s' path '%s'\n",
|
||||
NS_LossyConvertUTF16toASCII(volMountPoint).get(),
|
||||
NS_LossyConvertUTF16toASCII(aStorageType).get());
|
||||
}
|
||||
#else
|
||||
f = sDirs->sdcard;
|
||||
#endif
|
||||
@ -945,6 +969,12 @@ DeviceStorageFile::GetRootDirectoryForType(const nsAString& aStorageType,
|
||||
|
||||
if (f) {
|
||||
f->Clone(aFile);
|
||||
} else {
|
||||
// This should never happen unless something is severely wrong. So
|
||||
// scream a little.
|
||||
printf_stderr("##### GetRootDirectoryForType('%s', '%s') failed #####",
|
||||
NS_LossyConvertUTF16toASCII(aStorageType).get(),
|
||||
NS_LossyConvertUTF16toASCII(aStorageName).get());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user