Debian Codegraph @

src/main/java/com/github/markusbernhardt/proxy/search/browser/firefox/WinFirefoxProfileSource.java

raw symbols SCIP
1 package com.github.markusbernhardt.proxy.search.browser.firefox;
2
3 import java.io.File;
4 import java.io.IOException;
5
6 import com.sun.jna.platform.win32.Shell32Util;
7 import com.sun.jna.platform.win32.ShlObj;
8
9 /*****************************************************************************
10 * Finds the Firefox profile on Windows platforms. On Windows the profiles are
11 * located in the users appdata directory under:
12 * <p>
13 * <i>Mozilla\Firefox\Profiles\</i>
14 * </p>
15 * The location of the appdata folder is read from the windows registry.
16 *
17 * @author Markus Bernhardt, Copyright 2016
18 * @author Bernd Rosstauscher, Copyright 2009
19 ****************************************************************************/
20
21 // TODO 02.06.2015 bros Format has changed in newer versions of firefox.
22
23 class WinFirefoxProfileSource implements FirefoxProfileSource {
24
25 /*************************************************************************
26 * Constructor
27 ************************************************************************/
28
29 public WinFirefoxProfileSource() {
30 super();
31 }
32
33 /*************************************************************************
34 * Reads the current location of the app data folder from the registry.
35 *
36 * @return a path to the folder.
37 ************************************************************************/
38
39 private String getAppFolder() {
40 return Shell32Util.getFolderPath(ShlObj.CSIDL_APPDATA);
41 }
42
43 /*************************************************************************
44 * Get profiles.ini for the Windows Firefox profile
45 *
46 * @throws IOException
47 * on error.
48 ************************************************************************/
49
50 @Override
51 public File getProfilesIni() throws IOException {
52 File appDataDir = new File(getAppFolder());
53 return new File(appDataDir, "Mozilla" + File.separator + "Firefox" + File.separator + "profiles.ini");
54 }
55
56 }