Copy unrar dll to cache folder. fix #2205
This commit is contained in:
+16
-11
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user