Skip to content

Commit 9285317

Browse files
committed
Before adding SSYFirefoxProfiler to the Firefox extension.
1 parent 8f696df commit 9285317

5 files changed

+509
-3
lines changed

SSYFirefoxPaths.h

-2
This file was deleted.

SSYFirefoxPaths.m

Whitespace-only changes.

SSYFirefoxProfiler.h

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#import <Cocoa/Cocoa.h>
2+
3+
4+
@interface SSYFirefoxProfiler : NSObject {
5+
}
6+
7+
8+
+ (NSArray*)profileNamesForHomePath:(NSString*)homePath ;
9+
10+
+ (NSString*)displayedSuffixForProfileName:(NSString*)profileName
11+
homePath:(NSString*)homePath ;
12+
13+
/*!
14+
@brief Gets path to the Firefox profile folder for a given Firefox profile
15+
name and home folder, or nil if a failure occurs
16+
17+
@details Operates by finding the Firefox profiles.ini file in a given home
18+
folder, parsing its entries to find the one pertaining to the given profile
19+
name, and resolving the profile folder path indicated by this entry.
20+
21+
This method performs the inverse of -profileNameForPath:error_p:.
22+
*/
23+
+ (NSString*)pathForProfileName:(NSString*)profileName
24+
homePath:(NSString*)homePath
25+
error_p:(NSError**)error_p ;
26+
27+
/*
28+
@brief Returns the Firefox profile name given a Firefox profile path
29+
@details Although I did this for years by simply taking the last path
30+
component of the profile path and un-tweaking it, in January 2014 I have
31+
evidence from at least one user that this doesn't always work. Specifically,
32+
his profile name is "Default" but the path to his profile is
33+
~/Library/Application Support/Firefox/Profiles
34+
That's correct, all of the 3-dozen-or-so files and folders containing his
35+
profile data are in the parent folder "Profiles" instead of in a subfolder.
36+
However, his profiles.ini file contains the correct information in the
37+
following entry…
38+
39+
[Profile0]
40+
Name=Default
41+
IsRelative=1
42+
Path=Profiles
43+
Default=1
44+
45+
Oh, well. So, after several hours, I have written this method which finds the
46+
Firefox profiles.ini file which is in the same Home folder that the given
47+
profile path is in, parses the entries in it until it finds the entry whose
48+
path description resolves to the given profile path, and finally extracts from
49+
that entry the profile name.
50+
51+
The old code which is 99% simpler but only works for 99+% of users, is given
52+
as a comment in the implementation file.
53+
54+
This method performs the inverse of -pathForProfileName:homePath:error_p:
55+
*/
56+
+ (NSString*)profileNameForPath:(NSString*)path
57+
error_p:(NSError**)error_p ;
58+
@end

0 commit comments

Comments
 (0)