JError JFormatPartition ( const JCharacter* path, const JCharacter* type, JProcess** process ) { JBoolean writable, isTop; JString device; if (JIsMounted(path, &writable, &isTop, &device) && isTop) { JMount(path, kJFalse, kJTrue); if (!JIsMounted(path)) { const JCharacter* argv[] = { "xterm", "-T", "Format disk", "-n", "Format disk", "-e", "/sbin/mkfs", "-t", type, "-c", device, NULL }; const JError err = JProcess::Create(process, argv, sizeof(argv)); if (err.OK()) { JThisProcess::Ignore(*process); } return err; } } *process = NULL; return JAccessDenied(path); }
SyGTreeDir::SyGTreeDir ( const JCharacter* startPath ) : JXWindowDirector(JXGetApplication()), itsAutoMountFlag(kJFalse) { if ((SyGGetApplication())->IsMountPoint(startPath) && !JIsMounted(startPath)) { itsAutoMountFlag = kJTrue; (SyGGetApplication())->DisplayBusyCursor(); JMount(startPath, kJTrue, kJTrue); } BuildWindow(startPath); }
JIndex SyGGetMountPointLargeIcon ( const JCharacter* path, SyGFileTreeList* fileList, JXPM* plainIcon, JXPM* selectedIcon ) { JMountType type; const JBoolean isMP = theApplication->IsMountPoint(path, &type); if (!isMP) { JBoolean writable, isTop; JString device, fsTypeString; JFileSystemType fsType; if (JIsMounted(path, &writable, &isTop, &device, &fsType, &fsTypeString)) { type = JGetUserMountPointType(path, device, fsTypeString); } else { type = kJHardDisk; } } const JBoolean writable = JDirectoryWritable(path); JString dir; if (JGetHomeDirectory(&dir) && JSameDirEntry(dir, path)) { *plainIcon = syg_home_folder_large; *selectedIcon = syg_home_folder_selected_large; return 1; } else if (SyGIsTrashDirectory(path)) { (fileList->GetSyGFileTree())->Update(); if (fileList->IsEmpty()) { *plainIcon = jx_trash_can_empty_large; *selectedIcon = jx_trash_can_empty_selected_large; return 2; } else { *plainIcon = jx_trash_can_full_large; *selectedIcon = jx_trash_can_full_selected_large; return 3; } } else if (!isMP && type == kJFloppyDisk && !writable) { *plainIcon = syg_floppy_folder_read_only_large; *selectedIcon = syg_floppy_folder_read_only_large; return 4; } else if (!isMP && type == kJFloppyDisk) { *plainIcon = syg_floppy_folder_large; *selectedIcon = syg_floppy_folder_large; return 5; } else if (!isMP && type == kJCDROM && !writable) { *plainIcon = syg_cdrom_folder_read_only_large; *selectedIcon = syg_cdrom_folder_read_only_large; return 4; } else if (!isMP && type == kJCDROM) { *plainIcon = syg_cdrom_folder_large; *selectedIcon = syg_cdrom_folder_large; return 5; } else if (!isMP && !writable) { *plainIcon = jx_folder_read_only_large; *selectedIcon = jx_folder_read_only_selected_large; return 6; } else if (!isMP) { *plainIcon = jx_folder_large; *selectedIcon = jx_folder_selected_large; return 7; } else if (type == kJFloppyDisk) { *plainIcon = jx_floppy_disk_large; *selectedIcon = jx_floppy_disk_selected_large; return 8; } else if (type == kJCDROM) { *plainIcon = jx_cdrom_disk_large; *selectedIcon = jx_cdrom_disk_selected_large; return 9; } else { *plainIcon = jx_hard_disk_large; *selectedIcon = jx_hard_disk_selected_large; return 11; } }