Skip to content

Commit

Permalink
Merge feature/cloud with dev
Browse files Browse the repository at this point in the history
  • Loading branch information
brp14005 committed Mar 1, 2016
1 parent db99d64 commit ed62764
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 31 deletions.
2 changes: 2 additions & 0 deletions src/main/java/directory/FolderViewManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import javafx.scene.control.TreeView;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import utils.CmdExecutor;
import utils.OSDetection;

import java.io.BufferedReader;
import java.io.IOException;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/directory/IronFile.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package directory;

import utils.IronFileFilter;

import java.io.File;

/**
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/launcher/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import directory.IronFile;
import javafx.fxml.FXML;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
Expand Down Expand Up @@ -61,12 +62,12 @@ public void handle(ActionEvent event) {
}
});

DropboxController dbManager = new DropboxController();
/* DropboxController dbManager = new DropboxController();
try {
dbManager.test();
} catch (DbxException e) {
e.printStackTrace();
}
}*/
// directory.IronFile homeDir = new directory.IronFile(System.getProperty("user.home")); // use this for specific directory
// manager.setRootDirectory(homeDir);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main.java;
package utils;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -12,10 +12,7 @@ public class CmdExecutor {
public CmdExecutor() { }

public String run(String cmd) throws IOException {

System.out.println("executing command: " + cmd);


String[] args = new String[] {"sh", "-c", "cd / && " + cmd};
Process process = Runtime.getRuntime().exec(args);
BufferedReader outputReader = new BufferedReader(new InputStreamReader(process.getInputStream())); //efficiently reads chars
Expand All @@ -26,23 +23,17 @@ public String run(String cmd) throws IOException {

System.out.println("Below is command output: \n ");
while(line != null) {

System.out.println("cmd output: " + line);
line = outputReader.readLine();

}

while(error != null) {

System.out.println("error output: " + error);
error = errorReader.readLine();

}

outputReader.close();
errorReader.close();
return null;

}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main.java;
package utils;

import java.io.FilenameFilter;
import java.io.File;
Expand All @@ -10,26 +10,22 @@
public class IronFileFilter implements FilenameFilter {

public boolean accept(File file, String name) {

boolean hidden = false;
boolean isSymbolic = false;
boolean isRegularFile = false;

try {

hidden = Files.isHidden(file.toPath());
isSymbolic = Files.isSymbolicLink(file.toPath());
isRegularFile = Files.isRegularFile(file.toPath());
} catch(Exception e) {

} catch(Exception e) { }
}

if(hidden || isSymbolic || (!isRegularFile && !file.isDirectory())) {
//System.out.println(name + " is hidden or a symbolic link, or just not a regular file");
return false;
}

return true;

}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main.java;
package utils;

/**
* Created by kristopherguzman on 2/19/16.
Expand All @@ -13,30 +13,19 @@ public enum OS { WINDOWS, MAC, UNIX }
public static OS OSType;

public static void getOS() { //utility method to get OS

String os = System.getProperty("os.name").toLowerCase();

if(os.contains("win")) {

OSType = OS.WINDOWS;
System.out.println("OS: Windows");

} else if(os.contains("nix") || os.contains("ux") || os.contains("aix")) {

OSType = OS.UNIX;
System.out.println("OS: Unix/Linux");

} else if(os.contains("mac")) {

OSType = OS.MAC;
System.out.println("OS: Mac");

} else {

System.out.println("Could not detect OS");

}

}

}

0 comments on commit ed62764

Please sign in to comment.