[vlc-commits] commit: python-vlc: when doing the os.chdir hack on win32, restore the original path after DLL loading (Olivier Aubert )

git at videolan.org git at videolan.org
Thu Nov 18 18:45:31 CET 2010


vlc/python | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Thu Nov 18 18:34:09 2010 +0100| [66a811cf1ddb08bb4509fad7e08daaa84c59d533] | committer: Olivier Aubert 

python-vlc: when doing the os.chdir hack on win32, restore the original path after DLL loading

> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=66a811cf1ddb08bb4509fad7e08daaa84c59d533
---

 header.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/header.py b/header.py
index 10840f6..7c185f5 100755
--- a/header.py
+++ b/header.py
@@ -50,6 +50,7 @@ if sys.platform.startswith('linux'):
 elif sys.platform.startswith('win'):
     import ctypes.util
     p=ctypes.util.find_library('libvlc.dll')
+    current_path = os.getcwd()
     if p is None:
         import _winreg  # Try to use registry settings
         for r in _winreg.HKEY_LOCAL_MACHINE, _winreg.HKEY_CURRENT_USER:
@@ -73,6 +74,8 @@ elif sys.platform.startswith('win'):
     else:
         detected_plugin_path = os.path.dirname(p)
     dll=ctypes.CDLL(p)
+    # Restore correct path once the DLL is loaded
+    os.chdir(current_path)
     del p
 elif sys.platform.startswith('darwin'):
     # FIXME: should find a means to configure path



More information about the vlc-commits mailing list