Issue 5618 in pharo: #preferencesFolder in windows is broken

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo
Status: Accepted
Owner: [hidden email]
Labels: Type-Bug Milestone-2.0

New issue 5618 by [hidden email]: #preferencesFolder in windows is  
broken
http://code.google.com/p/pharo/issues/detail?id=5618

DosFileDirectory>>#preferencesFolder does not answer correct location in  
some versions of windows (for instance, xp, localized versions of it)



_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo

Comment #1 on issue 5618 by [hidden email]: #preferencesFolder in  
windows is broken
http://code.google.com/p/pharo/issues/detail?id=5618

see #5596 as related


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo

Comment #2 on issue 5618 by [hidden email]: #preferencesFolder in  
windows is broken
http://code.google.com/p/pharo/issues/detail?id=5618

see related http://code.google.com/p/pharo/issues/detail?id=5596



_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo

Comment #3 on issue 5618 by [hidden email]: #preferencesFolder  
in windows is broken
http://code.google.com/p/pharo/issues/detail?id=5618

also related http://code.google.com/p/pharo/issues/detail?id=5255


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo
Updates:
        Status: FixReviewNeeded
        Cc: [hidden email]

Comment #4 on issue 5618 by [hidden email]: #preferencesFolder in  
windows is broken
http://code.google.com/p/pharo/issues/detail?id=5618

I've just wrote a simple patch that makes  
DosFileDirectory>>preferencesRootPath answer the correct thing. This fixes  
#preferencesFolder. A better patch would use the PlatformResolver  
infrastructure from FileSystem.

preferencesRootPath
        "For further details refer to Pharo Issue #5618"

        |  osMajorVer osMinorVer rootPath exeFolderList  fallbackRootPath |
       
        "First try to adhere to hardcoded Microsoft conventions - though we really  
should be reading environment variables since %SYSTEMDRIVE% might not be  
C: "
       
        osMajorVer := Smalltalk os osVersion first.
        osMinorVer := Smalltalk os osVersion third.
        osMajorVer >= $6 ifTrue: [ rootPath := 'C:\ProgramData\'  
].   "Vista, 2008, 7 and later"
        osMajorVer = $5 ifTrue: [ rootPath := 'C:\Documents and Settings\All  
Users\Application Data\' ]. "2000, XP, 2003"
        osMajorVer = $4 ifTrue:
        [   rootPath := 'C:\Windows\All Users\Application Data\' . "98,  
98SE, Me"
            osMinorVer = $0 ifTrue: [ rootPath := 'C:\WinNT\Profiles\All  
Users\Application Data\' ] .    "NT 4"
        ].
        osMajorVer = $3 ifTrue: [ rootPath := 'C:\WinNT\Profiles\All  
Users\Application Data\' ] . "NT 3.1 3.5 3.51"

        "An alternative fall back folder in case system locked down such that user  
cannot follow Microsoft conventions above, or is using a portable drive on  
a new system"
        exeFolderList := (self default fullName subStrings: self slash) copyFrom:  
1 to: 2.
        fallbackRootPath := (exeFolderList joinUsing: self slash).

        "Now work out which rootPath user is using.  Perhaps we should inform  
users of their specific options"
        rootPath ifNotNil: [ ( self forFileName: rootPath ) exists ifTrue: [  
^rootPath, 'pharo\' ] ].
        fallbackRootPath ifNotNil: [ ( self forFileName: fallbackRootPath ) exists  
ifTrue: [ ^fallbackRootPath, 'pharo\' ] ].
        ^ '\'. "Avoids later MNU"
       




_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo

Comment #5 on issue 5618 by [hidden email]: #preferencesFolder  
in windows is broken
http://code.google.com/p/pharo/issues/detail?id=5618

Part of the problem with preferencesRootPath wrote is that it tries to do  
two things.  I didn't know about PreferencesHandler>>buildActionList when I  
wrote it.  Now it seems like "fallbackRootPath" is duplicating what  
buildActionList does.  This just tried to match the functionality in  
UnixFileDirectory>>preferencesFolder.

Now that I know about PreferencesHandler>>buildActionList, I actually think  
that DosFileDirectory>>preferencesFolder should be reverted to be similar  
to UnixFileDirectory>>preferencesFolder - but both changed to check for  
a "config" folder at each parent folder.

I wrote the initial DosFileDirectory>>preferencesRootPath to use the  
standard MS Windows locations because I was unhappy with the assumption in  
UnixFileDirectory>>preferencesFolder that the .config file would be exactly  
two folder down from root - since mine happened to be located three down.  
A general alternative here might be recursively check each parentFolder for  
a "config" folder.  I'd be happy with that instead of trying to match the  
AppData folder each version of Windows.

However getting the correct AppData folder may still be a useful feature to  
match corporate IT policies.  I have factored out the main part of this to  
the attached files.  PreferencesHandler>>buildActionList might then have...
                add: [self lookInAppDataFolder ];
I was going to ask for contributions to testAppDataFolderForOSVersions from  
Windwos users on the maillist.

I also think there could be some refactoring to reduce code duplication  
between the different platform XXXFileDirectoy.

I am happy to proceed further with the above suggestions, but will await  
some direction from the main developers.

Attachments:
        DosFileDirectoryTests-testAppDataFolderForOSVersions.st  2.3 KB
        DosFileDirectory class-appDataFolderFor.st  1.2 KB


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo

Comment #6 on issue 5618 by [hidden email]: #preferencesFolder  
in windows is broken
http://code.google.com/p/pharo/issues/detail?id=5618

Of course the other alternative is to be able to environment variables.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo

Comment #7 on issue 5618 by [hidden email]: #preferencesFolder  
in windows is broken
http://code.google.com/p/pharo/issues/detail?id=5618

My attachements might still be useful code for corporate MS Windows usage  
but I have backed away from this approach to get StartupPreference working  
for Windows.  See issue 5385


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo

Comment #8 on issue 5618 by [hidden email]: #preferencesFolder  
in windows is broken
http://code.google.com/p/pharo/issues/detail?id=5618

My attachements might still be useful code for corporate MS Windows usage  
but I have backed away from this approach to get StartupPreference working  
for Windows.  See  issue 5835


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo
Updates:
        Status: WontFix

Comment #9 on issue 5618 by [hidden email]: #preferencesFolder in  
windows is broken
http://code.google.com/p/pharo/issues/detail?id=5618

so I guess we can close this?


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5618 in pharo: #preferencesFolder in windows is broken

pharo

Comment #10 on issue 5618 by marianopeck: #preferencesFolder in windows is  
broken
http://code.google.com/p/pharo/issues/detail?id=5618

yes, sorry, this should be closed.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker