|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2015 - 2016 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 |