Example usage for org.apache.commons.io FilenameUtils getFullPath

List of usage examples for org.apache.commons.io FilenameUtils getFullPath

Introduction

In this page you can find the example usage for org.apache.commons.io FilenameUtils getFullPath.

Prototype

public static String getFullPath(String filename) 

Source Link

Document

Gets the full path from a full filename, which is the prefix + path.

Usage

From source file:MSUmpire.DIA.DIAPack.java

public String GetQ3Pepxml() {
    return FilenameUtils.separatorsToUnix(FilenameUtils.getFullPath(Filename) + "interact-"
            + FilenameUtils.getBaseName(GetQ3Name()) + ".pep.xml");
}

From source file:hu.tbognar76.apking.ApKing.java

private void moveFilesFromAPK_INtoAPK_READY(File[] files, boolean isSamePackageFeature,
        boolean isGooglePlayCategoryFeauture) {
    for (File file : files) {
        if (file.isDirectory()) {
            // System.out.println("Directory: " + file.getName());
            moveFilesFromAPK_INtoAPK_READY(file.listFiles(), isSamePackageFeature,
                    isGooglePlayCategoryFeauture); // Calls
            // same
            // method again.
        } else {//from  w ww .  j av a2 s  .  co  m
            // System.out.println("File: " + file.getName());
            // System.out.println("File: " + file.getPath());

            // it will put the new APK in a same folder where the old one
            // was (in a same folder) (by package name)
            ApkInfo apkinfo = null;
            ApkMeta apkMeta = null;
            apkMeta = getPackage(file.getPath());

            if (isSamePackageFeature) {
                if (packageHash.containsKey(apkMeta.getPackageName())) {
                    // FOUND
                    ArrayList<ApkInfo> apkinfos = packageHash.get(apkMeta.getPackageName());
                    // If more then the select the first
                    apkinfo = apkinfos.get(0);
                    // }
                    // apkinfo.fullpath

                    String pathOLD = FilenameUtils.getFullPath(apkinfo.fullpath);
                    String filenameOLD = FilenameUtils.getName(apkinfo.fullpath);
                    String filenameNEW = FilenameUtils.getName(file.getPath());
                    if (filenameOLD.equals(filenameNEW)) {
                        filenameNEW = FilenameUtils.getBaseName(file.getPath()) + "_(new)."
                                + FilenameUtils.getExtension(file.getPath());
                    }

                    if (this.init.isMoveFromIN) {
                        if (file.renameTo(new File(pathOLD + filenameNEW))) {

                        } else {
                            System.out.println("File is failed to move next to its prev version! " + pathOLD
                                    + filenameNEW);
                        }
                    }
                    System.out.println("Moved " + concatWithPos(filenameNEW, " to " + pathOLD, 30));
                }
            }

            if (isGooglePlayCategoryFeauture && apkinfo == null) {

                GoogleCategory cc = new GoogleCategory();

                if (apkMeta != null) {
                    String packname = apkMeta.getPackageName();
                    // System.out.println(file.getName()+"        "+packname);
                    if (packname == null || packname.equals("")) {
                        System.out.println("ERROR PASING PACKAGE: " + file.getName());
                        cc.cat1 = "Unknown";
                        cc.cat2 = "Unknown Package";
                    } else {
                        //
                        // Google Play parser call!
                        //
                        cc = getCategoryFromGooglePlayStore(packname);
                    }
                } else {
                    System.out.println("ERROR PARSING PACKAGE 2: " + file.getName());
                    cc.cat1 = "Unknown";
                    cc.cat2 = "Unknown Package";
                }

                String renamedfile = this.init.outPath + "/" + cc.cat1 + "/" + cc.cat2 + "/" + file.getName();
                String renamedpath1 = this.init.outPath + "/" + cc.cat1 + "/";
                String renamedpath2 = this.init.outPath + "/" + cc.cat1 + "/" + cc.cat2 + "/";

                // create dirs move files
                if (this.init.isMoveFromIN) {
                    makeDir(renamedpath1);
                    makeDir(renamedpath2);

                    if (file.renameTo(new File(renamedfile))) {

                    } else {
                        System.out.println("File is failed to move!" + renamedfile);
                    }
                }
                System.out.println(concatWithPos(concatWithPos(cc.cat1, cc.cat2, 12), file.getName(), 40));
            }
        }
    }
}

From source file:aurelienribon.gdxsetupui.ProjectSetup.java

private String getSource(List<String> files, String file) {
    String path = FilenameUtils.getFullPath(file);
    String name = FilenameUtils.getBaseName(file);
    String ext = FilenameUtils.getExtension(file);

    if (files.contains(path + name + "-source." + ext))
        return path + name + "-source." + ext;
    if (files.contains(path + name + "-sources." + ext))
        return path + name + "-sources." + ext;
    if (files.contains(path + name + "-src." + ext))
        return path + name + "-src." + ext;
    return null;//from  w w w.j av a 2  s . com
}

From source file:MSUmpire.DIA.DIAPack.java

public String GetIPROPHETPepXML() {
    return FilenameUtils.getFullPath(Filename) + "interact-" + FilenameUtils.getBaseName(Filename)
            + ".iproph.pep.xml";
}

From source file:MSUmpire.DIA.DIAPack.java

public String GetIPROPHETProtXML() {
    return FilenameUtils.getFullPath(Filename) + "interact-" + FilenameUtils.getBaseName(Filename)
            + ".iproph.prot.xml";
}

From source file:MSUmpire.DIA.DIAPack.java

public String GetCombinePepXML() {
    return FilenameUtils.getFullPath(Filename) + "interact-" + FilenameUtils.getBaseName(Filename)
            + "_Combine.pep.xml";
}

From source file:com.money.manager.ex.database.MmxOpenHelper.java

public void createDatabaseBackupOnUpgrade(String currentDbFile, int oldVersion) throws IOException {
    File in = new File(currentDbFile);
    String backupFileNameWithExtension = in.getName();

    String backupName = FilenameUtils.getBaseName(backupFileNameWithExtension);
    String backupExtension = FilenameUtils.getExtension(backupFileNameWithExtension);

    // append last db version
    backupName += "_v" + Integer.toString(oldVersion);

    backupFileNameWithExtension = backupName + "." + backupExtension;

    String outPath = FilenameUtils.getFullPath(currentDbFile) + backupFileNameWithExtension;
    File out = new File(outPath);

    FileUtils.copyFile(in, out);/*from w  w  w  .  ja v  a2 s. co m*/
}

From source file:MSUmpire.DIA.DIAPack.java

public String GetCombineProtXML() {
    return FilenameUtils.getFullPath(Filename) + "interact-" + FilenameUtils.getBaseName(Filename)
            + "_Combine.prot.xml";
}

From source file:MSUmpire.DIA.DIAPack.java

public String GetCombineiProphProtXML() {
    return FilenameUtils.getFullPath(Filename) + "interact-" + FilenameUtils.getBaseName(Filename)
            + "_Combine.iproph.prot.xml";
}

From source file:MSUmpire.PSMDataStructure.LCMSID.java

private void ExportMappedPepIonCSV() throws IOException {
    Logger.getRootLogger()//from ww  w .jav a2  s . co  m
            .info("Writing MappedPepIonIDs result to file:" + FilenameUtils.getFullPath(mzXMLFileName)
                    + FilenameUtils.getBaseName(mzXMLFileName) + "_MappedPepIonIDs.csv...");
    FileWriter writer = new FileWriter(FilenameUtils.getFullPath(mzXMLFileName)
            + FilenameUtils.getBaseName(mzXMLFileName) + "_MappedPepIonIDs.csv");
    writer.write(
            "PepIndex,Sequence,ModSeq,TPPModSeq,ModInfo,Charge,mz,PredictRT, PeakRT,MS1ClusIndex,MS2ClusIndex,PeakScore,PeakHeight1,PeakHeight2,PeakHeight3,PeakArea1,PeakArea2,PeakArea3,MS1AlignmentProb,MS1AlignmentLProb,MS2AlignmentProb,MS2AlignmentLProb\n");
    int index = 1;
    for (PepIonID pepion : MappedPepIonList.values()) {
        writer.write((index++) + "," + pepion.Sequence + "," + pepion.ModSequence + "," + pepion.TPPModSeq + ","
                + pepion.GetModificationString() + "," + pepion.Charge + "," + pepion.NeutralPrecursorMz() + ","
                + pepion.PredictRTString() + "," + pepion.PeakRT + "," + pepion.GetMS1ClusIndex() + ","
                + pepion.GetMS2ClusIndex() + "," + pepion.PeakClusterScore + "," + pepion.PeakHeight[0] + ","
                + pepion.PeakHeight[1] + "," + pepion.PeakHeight[2] + "," + pepion.PeakArea[0] + ","
                + pepion.PeakArea[1] + "," + pepion.PeakArea[2] + "," + pepion.MS1AlignmentProbability + ","
                + pepion.UScoreProbability_MS1 + "," + pepion.MS2AlignmentProbability + ","
                + pepion.UScoreProbability_MS2 + "\n");
    }
    writer.close();
}