mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-14 17:53:37 +00:00
50 lines
1.8 KiB
Diff
50 lines
1.8 KiB
Diff
--- blink-2.0.0/blink/resources.py 2016-03-09 14:39:07.000000000 +0100
|
|
+++ blink-2.0.0/blink/resources-patched.py 2016-03-12 21:34:14.965476623 +0100
|
|
@@ -1,7 +1,10 @@
|
|
+# Copyright (C) 2010-2013 AG Projects. See LICENSE for details.
|
|
+#
|
|
|
|
"""Provide access to Blink's resources"""
|
|
|
|
-import __main__
|
|
+__all__ = ['ApplicationData', 'Resources', 'IconManager']
|
|
+
|
|
import imghdr
|
|
import os
|
|
import platform
|
|
@@ -19,14 +22,10 @@
|
|
from blink.util import run_in_gui_thread
|
|
|
|
|
|
-__all__ = ['ApplicationData', 'Resources', 'IconManager']
|
|
-
|
|
-
|
|
class DirectoryContextManager(unicode):
|
|
def __enter__(self):
|
|
self.directory = os.getcwdu()
|
|
os.chdir(self)
|
|
-
|
|
def __exit__(self, type, value, traceback):
|
|
os.chdir(self.directory)
|
|
|
|
@@ -61,18 +60,7 @@
|
|
@classproperty
|
|
def directory(cls):
|
|
if cls._cached_directory is None:
|
|
- try:
|
|
- binary_directory = os.path.dirname(os.path.realpath(__main__.__file__))
|
|
- except AttributeError:
|
|
- if hasattr(sys, 'frozen'):
|
|
- application_directory = os.path.dirname(os.path.realpath(sys.executable))
|
|
- else:
|
|
- application_directory = os.path.realpath('') # executed in interactive interpreter
|
|
- else:
|
|
- if os.path.basename(binary_directory) == 'bin':
|
|
- application_directory = os.path.dirname(binary_directory)
|
|
- else:
|
|
- application_directory = binary_directory
|
|
+ application_directory = '@out@'
|
|
if os.path.exists(os.path.join(application_directory, 'resources', 'blink.ui')):
|
|
cls._cached_directory = os.path.join(application_directory, 'resources').decode(sys.getfilesystemencoding())
|
|
else:
|