Example usage for java.util.prefs BackingStoreException printStackTrace

List of usage examples for java.util.prefs BackingStoreException printStackTrace

Introduction

In this page you can find the example usage for java.util.prefs BackingStoreException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.ethanruffing.preferenceabstraction.AutoPreferences.java

/**
 * Produces a list of all stored keys.//from  w  w w  .j a  va  2 s. c  om
 *
 * @return A list of keys for all preferences currently stored.
 */
@Override
public List<String> getKeys() {
    if (configType == ConfigurationType.SYSTEM) {
        try {
            return Arrays.asList(prefs.keys());
        } catch (BackingStoreException e) {
            e.printStackTrace();
            return new ArrayList<String>();
        }
    } else {
        return IteratorUtils.toList(fileConfig.getKeys());
    }
}

From source file:edu.ku.brc.specify.prefs.AttachmentPrefs.java

/**
 * //from ww w  . ja va  2 s .c o  m
 */
public AttachmentPrefs() {
    super();

    createForm("Preferences", "Attachments");

    PanelViewable pathPanel = form.getCompById("path_panel");
    PanelViewable urlPanel = form.getCompById("url_panel");

    isPublicDefChk = form.getCompById(ATTCH_PUB_DEF);
    pathBrwse = form.getCompById(ATTCH_PATH_ID);
    pathLbl = form.getLabelFor(ATTCH_PATH_ID);
    urlTxt = form.getCompById(ATTCH_URL_ID);
    urlLbl = form.getLabelFor(ATTCH_URL_ID);
    keyTxt = form.getCompById(ATTCH_KEY_ID);
    keyLbl = form.getLabelFor(ATTCH_KEY_ID);

    isInitialized = pathPanel != null && urlPanel != null && pathBrwse != null && pathLbl != null
            && urlTxt != null && urlLbl != null;
    if (!isInitialized) {
        UIRegistry.showError("The form is not setup correctly.");
        return;
    }

    isUsingGlobalAttchPrefs = globalPrefs.getBoolean(USE_GLOBAL_PREFS, false);
    canEditGlobalAttchPrefs = localPrefs.getBoolean(EDT_GLOBAL_PREFS, false);

    UIRegistry.loadAndPushResourceBundle("preferences");
    pathRB = UIHelper.createRadioButton(UIRegistry.getResourceString("USE_ATTACH_PATH"));
    urlRB = UIHelper.createRadioButton(UIRegistry.getResourceString("USE_ATTACH_URL"));
    UIRegistry.popResourceBundle();

    pathRB.setOpaque(false);
    urlRB.setOpaque(false);

    ButtonGroup group = new ButtonGroup();
    group.add(pathRB);
    group.add(urlRB);

    CellConstraints cc = new CellConstraints();
    if (pathPanel != null)
        pathPanel.add(pathRB, cc.xy(1, 1));
    if (urlPanel != null)
        urlPanel.add(urlRB, cc.xy(1, 1));

    JButton saveGGblPrefs = form.getCompById("SaveGGblPrefs");
    JButton clearGGblPrefs = form.getCompById("ClearGGblPrefs");
    if (saveGGblPrefs != null) {
        saveGGblPrefs.setVisible(isUsingGlobalAttchPrefs && canEditGlobalAttchPrefs);
        saveGGblPrefs.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                oldAttachmentURL = (String) urlTxt.getText().trim();
                oldAttachmentKey = (String) keyTxt.getText().trim();

                globalPrefs.put(ATTACHMENT_PATH, oldAttachmentPath);
                globalPrefs.put(ATTACHMENT_URL, oldAttachmentURL);
                globalPrefs.put(ATTACHMENT_KEY, oldAttachmentKey);
                globalPrefs.putBoolean(ATTACHMENT_USE_PATH, pathRB.isSelected());

                // Make sure local prefs is set for the type we are using.
                localPrefs.putBoolean(ATTACHMENT_USE_PATH, pathRB.isSelected());

                //remotePrefs.putBoolean(ATTCH_PUB_DEF, isPublicDefChk.isSelected());
            }
        });
    }

    if (clearGGblPrefs != null) {
        clearGGblPrefs.setVisible(isUsingGlobalAttchPrefs && canEditGlobalAttchPrefs);
        clearGGblPrefs.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                globalPrefs.remove(ATTACHMENT_PATH);
                globalPrefs.remove(ATTACHMENT_URL);
                globalPrefs.remove(ATTACHMENT_KEY);
                globalPrefs.remove(ATTACHMENT_USE_PATH);
                try {
                    globalPrefs.flush();
                } catch (BackingStoreException e) {
                    e.printStackTrace();
                }
            }
        });
    }

    if (!isUsingGlobalAttchPrefs || canEditGlobalAttchPrefs) {
        ActionListener al = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                toggleAttachmentsEnabledState(pathRB.isSelected());
            }
        };
        pathRB.addActionListener(al);
        urlRB.addActionListener(al);
    } else {
        pathBrwse.setEnabled(false);
        urlTxt.setEnabled(false);
        keyTxt.setEnabled(false);
        pathRB.setEnabled(false);
        urlRB.setEnabled(false);
    }

    setDataIntoUI();
}

From source file:com.delcyon.capo.Configuration.java

public void setValue(Preference preference, String value) {
    putPref(preference.getLongOption(), value);
    try {/*from  w  ww. ja  v a 2 s .com*/
        sync();
    } catch (BackingStoreException e) {
        e.printStackTrace();
    }

}

From source file:com.itemanalysis.jmetrik.gui.JmetrikPreferencesManager.java

/**
 * For debugging only/*ww  w . jav a 2 s. co  m*/
 */
public void printAllPreferences() {
    try {
        for (String s : p.keys()) {
            System.out.println(s + " = " + p.get(s, ""));
        }
    } catch (BackingStoreException ex) {
        ex.printStackTrace();
    }
}

From source file:com.itemanalysis.jmetrik.gui.JmetrikPreferencesManager.java

/**
 * For debugging and development only//w  ww  .j av  a  2  s  .c  o  m
 */
private void removeAllPreferences() {
    try {
        for (String s : p.keys()) {
            p.remove(s);
        }
    } catch (BackingStoreException ex) {
        ex.printStackTrace();
    }
}

From source file:com.delcyon.capo.Configuration.java

/**
 * command line values take precedence over saved preferences 
 * @param preference//from  ww  w  .j a  va  2  s .  co  m
 * @return
 */
public String getValue(Preference preference) {
    if (commandLine.hasOption(preference.getOption())) {
        //if the retain flag is specified persist the option or if the option exists and there is a default value, but no value in the preferences
        if (hasOption(PREFERENCE.RETAIN) || (getPref(preference.getLongOption(), null) == null
                && preference.getDefaultValue() != null)) {
            putPref(preference.getLongOption(), commandLine.getOptionValue(preference.getOption()));
            try {
                sync();
            } catch (BackingStoreException e) {
                e.printStackTrace();
            }
        }
        return commandLine.getOptionValue(preference.getOption());
    } else {
        //if there isn't a preference set and there is a default value then store the default in the preferences
        //this is how we save the initial configuration
        if (getPref(preference.getLongOption(), null) == null && preference.getDefaultValue() != null) {
            putPref(preference.getLongOption(), preference.getDefaultValue());
            try {
                sync();
            } catch (BackingStoreException e) {
                e.printStackTrace();
            }
        }
        return getPref(preference.getLongOption(), null);
    }
}

From source file:net.sf.profiler4j.console.Console.java

public void exit() {

    try {/*from www.j  ava 2s  .  c  o m*/
        prefs.flush();
    } catch (BackingStoreException e) {
        System.err.println("ERROR: could not flush preferences to disk");
        e.printStackTrace();
    }

    if (checkUnsavedChanges()) {
        return;
    }

    if (sendEvent(AppEventType.APP_CLOSING)) {
        return;
    }
    if (client.isConnected()) {
        disconnect();
        if (!client.isConnected()) {
            sendEvent(AppEventType.APP_CLOSED);
            System.exit(0);
        }
    } else {
        sendEvent(AppEventType.APP_CLOSED);
        System.exit(0);
    }
}

From source file:edu.ku.brc.specify.dbsupport.BuildFromGeonames.java

/**
 * Unzips and loads the SQL backup of the geonames database needed for building the full geography tree.
 * @param doAsynchronously whether it is done asynchronously in the background
 * @return true if build correctly.//w  w w  .  j  a va  2  s .  com
 */
public boolean loadGeoNamesDB(final String databaseName) {
    // See if date of file matches the last time the file was restored
    boolean isDatesMatch = true;
    final File file = new File(XMLHelper.getConfigDirPath("geonames.sql.zip"));
    //System.out.println(file.getAbsolutePath());
    if (file.exists()) {
        Long lastModLong = getLastGeonamesBuiltTime();
        long prefMilli = lastModLong != null ? lastModLong : 0;
        isDatesMatch = file.lastModified() == prefMilli;

    } else {
        return false;
    }

    DBMSUserMgr dbMgr = null;
    boolean shouldLoadGeoNames = true;
    try {
        DBConnection currDBConn = DBConnection.getInstance();
        dbMgr = DBMSUserMgr.getInstance();
        if (dbMgr == null)
            return false;

        String dbName = databaseName != null ? databaseName : currDBConn.getDatabaseName();
        //DBMSUserMgr.DBSTATUS status = DBMSUserMgr.checkForDB(dbName, currDBConn.getServerName(), itUsername, itPassword); // opens and closes connection

        if (!dbMgr.connectToDBMS(itUsername, itPassword, currDBConn.getServerName(), dbName,
                currDBConn.isEmbedded())) {
            UIRegistry.showError("Unable to login as IT user. ");
            return false;
        }

        boolean isDBOk = true;
        //boolean isDBOk           = false;
        boolean isGeoNameTableOK = false;

        //XXX
        //For unknown reasons, on Windows 8, the checkForDB call above fails because the embedded-db directory structure appears to have not yet been created.
        //Currently, this method is not called from a context in which it would make sense for it to create the db the geonames are being added to if it did not already exist.
        //So it is probably safe to assume, that if we are here, the db exists, and this code is not necessary.
        //Removing fixes the Windows 8 issue.

        //if (status == DBMSUserMgr.DBSTATUS.missingDB)
        //{
        //    if (!dbMgr.createDatabase(dbName))
        //    {
        //        UIRegistry.showLocalizedError("ERROR_CRE_GEODB", dbName);
        //    } else
        //    {
        //        isDBOk = true;
        //    }
        //        
        //} else
        //{
        //    isDBOk = true;
        //}

        if (isDBOk) {
            if (dbMgr.doesDBHaveTable(dbName, "geoname")) {
                isGeoNameTableOK = BasicSQLUtils.getCountAsInt(currDBConn.getConnection(), CNT_SQL) > 30000;
            }
            shouldLoadGeoNames = !isGeoNameTableOK || !isDatesMatch;
        } else {
            return false;
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(BuildFromGeonames.class, ex);
        return false;

    } finally {
        if (dbMgr != null)
            dbMgr.close();
    }

    //shouldLoadGeoNames = /*true*/false; //the geonames file has not been updated for 6.6.03
    shouldLoadGeoNames = true; //change above breaks db create wizard. #10178
    if (shouldLoadGeoNames) {
        BackupServiceFactory bsf = BackupServiceFactory.getInstance();
        bsf.setUsernamePassword(itUsername, itPassword);

        //String  dbName = DBConnection.getInstance().getDatabaseName();

        // 2nd to last 'true' - does it synchronously, last boolean 'false' means drop database
        DBConnection currDBConn = DBConnection.getInstance();
        String dbName = databaseName != null ? databaseName : currDBConn.getDatabaseName();
        boolean status = bsf.doRestoreBulkDataInBackground(dbName, null, file.getAbsolutePath(), null, null,
                null, true, false);
        if (status) {
            //File createFile = bsf.getUnzippedFileByName("continentcodes.txt");
            buildISOCodes();
        }

        AppPreferences appPrefs = getGlobalPrefs();
        if (appPrefs != null) {
            appPrefs.putLong(GEONAMES_DATE_PREF, status ? file.lastModified() : 0);
            try {
                appPrefs.flush();
            } catch (BackingStoreException e) {
                e.printStackTrace();
            }
        }
        // Clear IT Username and Password
        bsf.setUsernamePassword(null, null);

        return status;
    }
    return true;
}

From source file:net.sf.jabref.JabRef.java

public Optional<Vector<ParserResult>> processArguments(String[] args, boolean initialStartup) {

    cli = new JabRefCLI(args);

    if (!cli.isBlank() && cli.isDebugLogging()) {
        JabRefLogger.setDebug();// w w w.ja v a  2s  .c om
    }

    if (initialStartup && cli.isShowVersion()) {
        cli.displayVersion();
    }

    if (initialStartup && cli.isHelp()) {
        cli.printUsage();
        return Optional.empty();
    }

    // Check if we should reset all preferences to default values:
    if (cli.isPreferencesReset()) {
        String value = cli.getPreferencesReset();
        if ("all".equals(value.trim())) {
            try {
                System.out.println(Localization.lang("Setting all preferences to default values."));
                Globals.prefs.clear();
            } catch (BackingStoreException e) {
                System.err.println(Localization.lang("Unable to clear preferences."));
                e.printStackTrace();
            }
        } else {
            String[] keys = value.split(",");
            for (String key : keys) {
                if (Globals.prefs.hasKey(key.trim())) {
                    System.out.println(Localization.lang("Resetting preference key '%0'", key.trim()));
                    Globals.prefs.clear(key.trim());
                } else {
                    System.out.println(Localization.lang("Unknown preference key '%0'", key.trim()));
                }
            }
        }

    }

    // Check if we should import preferences from a file:
    if (cli.isPreferencesImport()) {
        try {
            Globals.prefs.importPreferences(cli.getPreferencesImport());
            CustomEntryTypesManager.loadCustomEntryTypes(Globals.prefs);
            ExportFormats.initAllExports();
        } catch (JabRefException ex) {
            LOGGER.error("Cannot import preferences", ex);
        }
    }

    // Vector to put imported/loaded database(s) in.
    Vector<ParserResult> loaded = new Vector<>();
    Vector<String> toImport = new Vector<>();
    if (!cli.isBlank() && (cli.getLeftOver().length > 0)) {
        for (String aLeftOver : cli.getLeftOver()) {
            // Leftover arguments that have a "bib" extension are interpreted as
            // bib files to open. Other files, and files that could not be opened
            // as bib, we try to import instead.
            boolean bibExtension = aLeftOver.toLowerCase().endsWith("bib");
            ParserResult pr = null;
            if (bibExtension) {
                pr = JabRef.openBibFile(aLeftOver, false);
            }

            if ((pr == null) || (pr == ParserResult.INVALID_FORMAT)) {
                // We will try to import this file. Normally we
                // will import it into a new tab, but if this import has
                // been initiated by another instance through the remote
                // listener, we will instead import it into the current database.
                // This will enable easy integration with web browsers that can
                // open a reference file in JabRef.
                if (initialStartup) {
                    toImport.add(aLeftOver);
                } else {
                    loaded.add(JabRef.importToOpenBase(aLeftOver).orElse(ParserResult.INVALID_FORMAT));
                }
            } else if (pr != ParserResult.FILE_LOCKED) {
                loaded.add(pr);
            }

        }
    }

    if (!cli.isBlank() && cli.isFileImport()) {
        toImport.add(cli.getFileImport());
    }

    for (String filenameString : toImport) {
        importFile(filenameString).ifPresent(loaded::add);
    }

    if (!cli.isBlank() && cli.isImportToOpenBase()) {
        importToOpenBase(cli.getImportToOpenBase()).ifPresent(loaded::add);
    }

    if (!cli.isBlank() && cli.isFetcherEngine()) {
        fetch(cli.getFetcherEngine()).ifPresent(loaded::add);
    }

    if (cli.isExportMatches()) {
        if (!loaded.isEmpty()) {
            String[] data = cli.getExportMatches().split(",");
            String searchTerm = data[0].replace("\\$", " "); //enables blanks within the search term:
            //? stands for a blank
            ParserResult pr = loaded.elementAt(loaded.size() - 1);
            BibDatabase dataBase = pr.getDatabase();

            SearchQuery query = new SearchQuery(searchTerm,
                    Globals.prefs.getBoolean(JabRefPreferences.SEARCH_CASE_SENSITIVE),
                    Globals.prefs.getBoolean(JabRefPreferences.SEARCH_REG_EXP));
            BibDatabase newBase = new DatabaseSearcher(query, dataBase).getDatabaseFromMatches(); //newBase contains only match entries

            //export database
            if ((newBase != null) && (newBase.getEntryCount() > 0)) {
                String formatName;

                //read in the export format, take default format if no format entered
                switch (data.length) {
                case 3:
                    formatName = data[2];
                    break;
                case 2:
                    //default ExportFormat: HTML table (with Abstract & BibTeX)
                    formatName = "tablerefsabsbib";
                    break;
                default:
                    System.err.println(Localization.lang("Output file missing").concat(". \n \t ")
                            .concat(Localization.lang("Usage")).concat(": ")
                            + JabRefCLI.getExportMatchesSyntax());
                    return Optional.empty();
                } //end switch

                //export new database
                IExportFormat format = ExportFormats.getExportFormat(formatName);
                if (format == null) {
                    System.err.println(Localization.lang("Unknown export format") + ": " + formatName);
                } else {
                    // We have an ExportFormat instance:
                    try {
                        System.out.println(Localization.lang("Exporting") + ": " + data[1]);
                        format.performExport(newBase, pr.getMetaData(), data[1], pr.getEncoding(), null);
                    } catch (Exception ex) {
                        System.err.println(Localization.lang("Could not export file") + " '" + data[1] + "': "
                                + ex.getMessage());
                    }
                }
            } /*end if newBase != null*/ else {
                System.err.println(Localization.lang("No search matches."));
            }
        } else {
            System.err.println(Localization.lang("The output option depends on a valid input option."));
        } //end if(loaded.size > 0)
    }

    if (cli.isGenerateBibtexKeys()) {
        regenerateBibtexKeys(loaded);
    }

    if (cli.isAutomaticallySetFileLinks()) {
        automaticallySetFileLinks(loaded);
    }

    if (cli.isFileExport()) {
        if (!loaded.isEmpty()) {
            String[] data = cli.getFileExport().split(",");

            if (data.length == 1) {
                // This signals that the latest import should be stored in BibTeX
                // format to the given file.
                if (!loaded.isEmpty()) {
                    ParserResult pr = loaded.elementAt(loaded.size() - 1);
                    if (!pr.isInvalid()) {
                        try {
                            System.out.println(Localization.lang("Saving") + ": " + data[0]);
                            SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs);
                            Defaults defaults = new Defaults(BibDatabaseMode.fromPreference(
                                    Globals.prefs.getBoolean(JabRefPreferences.BIBLATEX_DEFAULT_MODE)));
                            BibDatabaseWriter databaseWriter = new BibDatabaseWriter();
                            SaveSession session = databaseWriter.saveDatabase(
                                    new BibDatabaseContext(pr.getDatabase(), pr.getMetaData(), defaults),
                                    prefs);

                            // Show just a warning message if encoding didn't work for all characters:
                            if (!session.getWriter().couldEncodeAll()) {
                                System.err.println(Localization.lang("Warning") + ": " + Localization.lang(
                                        "The chosen encoding '%0' could not encode the following characters:",
                                        session.getEncoding().displayName()) + " "
                                        + session.getWriter().getProblemCharacters());
                            }
                            session.commit(new File(data[0]));
                        } catch (SaveException ex) {
                            System.err.println(Localization.lang("Could not save file.") + "\n"
                                    + ex.getLocalizedMessage());
                        }
                    }
                } else {
                    System.err
                            .println(Localization.lang("The output option depends on a valid import option."));
                }
            } else if (data.length == 2) {
                // This signals that the latest import should be stored in the given
                // format to the given file.
                ParserResult pr = loaded.elementAt(loaded.size() - 1);

                // Set the global variable for this database's file directory before exporting,
                // so formatters can resolve linked files correctly.
                // (This is an ugly hack!)
                File theFile = pr.getFile();
                if (!theFile.isAbsolute()) {
                    theFile = theFile.getAbsoluteFile();
                }
                MetaData metaData = pr.getMetaData();
                metaData.setFile(theFile);
                Globals.prefs.fileDirForDatabase = metaData.getFileDirectory(Globals.FILE_FIELD)
                        .toArray(new String[0]);
                Globals.prefs.databaseFile = metaData.getFile();
                System.out.println(Localization.lang("Exporting") + ": " + data[0]);
                IExportFormat format = ExportFormats.getExportFormat(data[1]);
                if (format == null) {
                    System.err.println(Localization.lang("Unknown export format") + ": " + data[1]);
                } else {
                    // We have an ExportFormat instance:
                    try {
                        format.performExport(pr.getDatabase(), pr.getMetaData(), data[0], pr.getEncoding(),
                                null);
                    } catch (Exception ex) {
                        System.err.println(Localization.lang("Could not export file") + " '" + data[0] + "': "
                                + ex.getMessage());
                    }
                }

            }
        } else {
            System.err.println(Localization.lang("The output option depends on a valid import option."));
        }
    }

    LOGGER.debug("Finished export");

    if (cli.isPreferencesExport()) {
        try {
            Globals.prefs.exportPreferences(cli.getPreferencesExport());
        } catch (JabRefException ex) {
            LOGGER.error("Cannot export preferences", ex);
        }
    }

    if (!cli.isBlank() && cli.isAuxImport()) {
        boolean usageMsg = false;

        if (!loaded.isEmpty()) // bibtex file loaded
        {
            String[] data = cli.getAuxImport().split(",");

            if (data.length == 2) {
                ParserResult pr = loaded.firstElement();
                AuxCommandLine acl = new AuxCommandLine(data[0], pr.getDatabase());
                BibDatabase newBase = acl.perform();

                boolean notSavedMsg = false;

                // write an output, if something could be resolved
                if (newBase != null) {
                    if (newBase.getEntryCount() > 0) {
                        String subName = StringUtil.getCorrectFileName(data[1], "bib");

                        try {
                            System.out.println(Localization.lang("Saving") + ": " + subName);
                            SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs);
                            BibDatabaseWriter databaseWriter = new BibDatabaseWriter();
                            Defaults defaults = new Defaults(BibDatabaseMode.fromPreference(
                                    Globals.prefs.getBoolean(JabRefPreferences.BIBLATEX_DEFAULT_MODE)));
                            SaveSession session = databaseWriter
                                    .saveDatabase(new BibDatabaseContext(newBase, defaults), prefs);

                            // Show just a warning message if encoding didn't work for all characters:
                            if (!session.getWriter().couldEncodeAll()) {
                                System.err.println(Localization.lang("Warning") + ": " + Localization.lang(
                                        "The chosen encoding '%0' could not encode the following characters:",
                                        session.getEncoding().displayName()) + " "
                                        + session.getWriter().getProblemCharacters());
                            }
                            session.commit(new File(subName));
                        } catch (SaveException ex) {
                            System.err.println(Localization.lang("Could not save file.") + "\n"
                                    + ex.getLocalizedMessage());
                        }

                        notSavedMsg = true;
                    }
                }

                if (!notSavedMsg) {
                    System.out.println(Localization.lang("no database generated"));
                }
            } else {
                usageMsg = true;
            }
        } else {
            usageMsg = true;
        }

        if (usageMsg) {
            System.out.println(Localization.lang("no base-BibTeX-file specified") + "!");
            System.out.println(Localization.lang("usage") + " :");
            System.out.println("jabref --aux infile[.aux],outfile[.bib] base-BibTeX-file");
        }
    }

    return Optional.of(loaded);
}

From source file:edu.ku.brc.specify.tools.StrLocalizerApp.java

/**
 * @return/*  ww  w . j  a v  a2  s. c  om*/
 */
protected String getDefaultPath() {
    String prefName = "StrLoc.BASEDIR";

    if (baseDir == null) {
        String lang = AppPreferences.getLocalPrefs().get(prefName, null);
        if (StringUtils.isEmpty(lang)) {
            lang = doChooseExistingLocalization();
            baseDir = new File(rootDir.getAbsolutePath() + File.separator + lang);
            try {
                AppPreferences.getLocalPrefs().flush();

            } catch (BackingStoreException e) {
                e.printStackTrace();
            }
            return baseDir.getAbsolutePath();
        } else {
            baseDir = new File(rootDir.getAbsolutePath() + File.separator + lang);
        }
    }
    return baseDir.getAbsolutePath();
}