eric6/Helpviewer/FlashCookieManager/FlashCookieUtilities.py

branch
maintenance
changeset 7286
7eb04391adf7
parent 7226
babe80d84a3e
parent 7285
1ff497f33f31
child 7287
1c17f2191bdd
equal deleted inserted replaced
7226:babe80d84a3e 7286:7eb04391adf7
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2015 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing some utility functions.
8 """
9
10 from __future__ import unicode_literals
11
12 import os
13
14 from PyQt5.QtCore import QProcessEnvironment
15
16 import Globals
17
18
19 def flashDataPathForOS():
20 """
21 Function to determine the OS dependent path where Flash cookies
22 are stored.
23
24 @return Flash data path
25 @rtype str
26 """
27 # On Microsoft Windows NT 5.x and 6.x, they are stored in:
28 # %APPDATA%\Macromedia\Flash Player\#SharedObjects\
29 # %APPDATA%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\
30 # On Mac OS X, they are stored in:
31 # ~/Library/Preferences/Macromedia/Flash Player/#SharedObjects/
32 # ~/Library/Preferences/Macromedia/Flash Player/macromedia.com/support/⏎
33 # flashplayer/sys/
34 # On Linux or Unix, they are stored in:
35 # ~/.macromedia/Flash_Player/#SharedObjects/
36 # ~/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/
37 # For Linux and Unix systems, if the open-source Gnash plugin is being used
38 # instead of the official Adobe Flash, they will instead be found at:
39 # ~/.gnash/SharedObjects/
40
41 flashPath = ""
42
43 if Globals.isWindowsPlatform():
44 appData = QProcessEnvironment.systemEnvironment().value("APPDATA")
45 appData = appData.replace("\\", "/")
46 flashPath = appData + "/Macromedia/Flash Player"
47 elif Globals.isMacPlatform():
48 flashPath = os.path.expanduser(
49 "~/Library/Preferences/Macromedia/Flash Player")
50 else:
51 if os.path.exists(os.path.expanduser("~/.macromedia")):
52 flashPath = os.path.expanduser("~/.macromedia/Flash_Player")
53 elif os.path.exists(os.path.expanduser("~/.gnash")):
54 flashPath = os.path.expanduser("~/.gnash")
55
56 return flashPath

eric ide

mercurial