Exemple #1
0
 // creaza un nou disk si un nou sistem de fisiere pe acesta
 public void newDisk(String diskName) {
   try {
     File newDisk = new File(System.getProperty("user.dir").toString() + "/" + diskName);
     if (newDisk.exists()) {
       System.out.println("Unable to create " + newDisk.getAbsolutePath());
     } else {
       newDisk.mkdirs();
       System.out.println("New disk created:" + diskName);
       addDiskRefernce(diskName);
       currentDiskPath = System.getProperty("user.dir").toString() + "\\" + diskName;
       currentPath = currentDiskPath;
     }
   } finally {
     takePath();
   }
 }
Exemple #2
0
 // incarca un disk existent de pe HDD; trebuie folosit un obiect de tip FileDialog
 public void load(String diskName) {
   try {
     String line;
     boolean ok = false;
     BufferedReader br = new BufferedReader(new FileReader("disks.txt"));
     while ((line = br.readLine()) != null) {
       if (line.equals(diskName)) ok = true;
     }
     if (ok == true) {
       System.out.println("Discul " + diskName + " a fost incarcat");
       currentDiskPath = System.getProperty("user.dir").toString() + "\\" + diskName;
       currentPath = currentDiskPath;
     } else System.out.println("Discul nu exista!");
   } catch (Exception e) {
   } finally {
     takePath();
   }
 }
Exemple #3
0
 // inchide sistemul de fisiere
 public void shutdown() {
   System.out.println("Consola a fost inchisa!");
   System.exit(0);
 }