本文整理匯總了Java中com.stericson.RootTools.RootTools.deleteFileOrDirectory方法的典型用法代碼示例。如果您正苦於以下問題:Java RootTools.deleteFileOrDirectory方法的具體用法?Java RootTools.deleteFileOrDirectory怎麽用?Java RootTools.deleteFileOrDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.stericson.RootTools.RootTools
的用法示例。
在下文中一共展示了RootTools.deleteFileOrDirectory方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteFile_su
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
private static boolean deleteFile_su(String file) {
boolean OK;
List<String> settingsPaths = RootTools.findBinary("rm", true);
if (settingsPaths.size() > 0) {
String command1 = "rm " + file;
//if (PPApplication.isSELinuxEnforcing())
// command1 = PPApplication.getSELinuxEnforceCommand(command1);
synchronized (PPApplication.startRootCommandMutex) {
Command command = new Command(0, false, command1);
try {
//RootTools.closeAllShells();
RootTools.getShell(true, Shell.ShellContext.RECOVERY).add(command);
OK = commandWait(command);
OK = OK && command.getExitCode() == 0;
} catch (Exception e) {
//e.printStackTrace();
OK = false;
}
}
}
else {
OK = RootTools.deleteFileOrDirectory(file, false);
}
return OK;
}
示例2: deleteFile_su
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
private static boolean deleteFile_su(String file) {
boolean OK;
List<String> settingsPaths = RootTools.findBinary("rm", true);
if (settingsPaths.size() > 0) {
synchronized (PPApplication.startRootCommandMutex) {
String command1 = "rm " + file;
//if (PPApplication.isSELinuxEnforcing())
// command1 = PPApplication.getSELinuxEnforceCommand(command1);
Command command = new Command(0, false, command1);
try {
//RootTools.closeAllShells();
RootTools.getShell(true, Shell.ShellContext.RECOVERY).add(command);
OK = commandWait(command);
OK = OK && command.getExitCode() == 0;
} catch (Exception e) {
//e.printStackTrace();
OK = false;
}
}
}
else {
OK = RootTools.deleteFileOrDirectory(file, false);
}
return OK;
}
示例3: deleteFileOrFolder
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public static void deleteFileOrFolder(String path) throws IOException
{
Logger.debug("Deleting File: " + path);
if (!path.contains("*") && !fileOrFolderExists(path))
{
throw new FileNotFoundException("File/folder not found: " + path);
}
// Escape spaces
path = path.replace(" ", "\\ ");
if (!RootTools.deleteFileOrDirectory(path, false))
{
throw new IOException("Failed to delete file or directory " + path);
}
}
示例4: deleteRootFileOrDir
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public static void deleteRootFileOrDir(File f) {
RootTools.deleteFileOrDirectory(getCommandLineString(f.getPath()), true);
}