eric6/WebBrowser/FlashCookieManager/FlashCookieUtilities.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7781
607a6098cb44
permissions
-rw-r--r--

Updated copyright for 2021.

4359
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
3 # Copyright (c) 2015 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4359
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing some utility functions.
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtCore import QProcessEnvironment
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 import Globals
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 def flashDataPathForOS():
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 Function to determine the OS dependent path where Flash cookies
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 are stored.
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 @return Flash data path
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 @rtype str
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 # On Microsoft Windows NT 5.x and 6.x, they are stored in:
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4359
diff changeset
26 # %APPDATA%\Macromedia\Flash Player\#SharedObjects\
4359
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 # %APPDATA%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 # On Mac OS X, they are stored in:
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 # ~/Library/Preferences/Macromedia/Flash Player/#SharedObjects/
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 # ~/Library/Preferences/Macromedia/Flash Player/macromedia.com/support/⏎
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 # flashplayer/sys/
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 # On Linux or Unix, they are stored in:
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 # ~/.macromedia/Flash_Player/#SharedObjects/
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 # ~/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 # For Linux and Unix systems, if the open-source Gnash plugin is being used
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 # instead of the official Adobe Flash, they will instead be found at:
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 # ~/.gnash/SharedObjects/
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 flashPath = ""
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 if Globals.isWindowsPlatform():
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 appData = QProcessEnvironment.systemEnvironment().value("APPDATA")
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 appData = appData.replace("\\", "/")
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 flashPath = appData + "/Macromedia/Flash Player"
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 elif Globals.isMacPlatform():
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 flashPath = os.path.expanduser(
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 "~/Library/Preferences/Macromedia/Flash Player")
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 else:
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 if os.path.exists(os.path.expanduser("~/.macromedia")):
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 flashPath = os.path.expanduser("~/.macromedia/Flash_Player")
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 elif os.path.exists(os.path.expanduser("~/.gnash")):
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 flashPath = os.path.expanduser("~/.gnash")
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
ac1dda9f3f19 Started adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 return flashPath
7249
0bf517e60f54 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
55
0bf517e60f54 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
56 #
0bf517e60f54 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
57 # eflag: noqa = M891

eric ide

mercurial