Copy unrar dll to cache folder. fix #2205

This commit is contained in:
Ruud
2013-09-20 16:06:23 +02:00
parent 7c79c6d1f3
commit 8d38fa87a4
15 changed files with 49 additions and 1128 deletions
+16 -11
View File
@@ -23,10 +23,10 @@
# Low level interface - see UnRARDLL\UNRARDLL.TXT
from __future__ import generators
import ctypes, ctypes.wintypes
import os, os.path, sys
import Queue
from couchpotato.environment import Env
from shutil import copyfile
import ctypes.wintypes
import os.path
import time
from rar_exceptions import *
@@ -64,13 +64,18 @@ UCM_NEEDPASSWORD = 2
architecture_bits = ctypes.sizeof(ctypes.c_voidp)*8
dll_name = "unrar.dll"
if architecture_bits == 64:
dll_name = "x64\\unrar64.dll"
try:
unrar = ctypes.WinDLL(os.path.join(os.path.split(__file__)[0], 'UnRARDLL', dll_name))
except WindowsError:
unrar = ctypes.WinDLL(dll_name)
dll_name = "unrar64.dll"
# Copy dll first
dll_file = os.path.join(os.path.dirname(__file__), dll_name)
dll_copy = os.path.join(Env.get('cache_dir'), 'copied.dll')
if os.path.isfile(dll_copy):
os.remove(dll_copy)
copyfile(dll_file, dll_copy)
unrar = ctypes.WinDLL(dll_copy)
class RAROpenArchiveDataEx(ctypes.Structure):