]> git.ekhem.eu.org Git - gdrive_knife.git/commitdiff
Hardcode /tmp instead of tempfile.
authorJakub Czajka <jczajka@google.com>
Sun, 12 Nov 2023 11:34:38 +0000 (12:34 +0100)
committerJakub Czajka <jakub@ekhem.eu.org>
Sun, 19 Nov 2023 13:59:20 +0000 (14:59 +0100)
tempfile does not resolve to '/tmp' on MacOS.

gdrive_knife.py

index 605ea7e2518da0a2a4203e685a9bb7c891a8aa93..312805f0838873ec22b87439c74f674d3df686e8 100644 (file)
@@ -6,7 +6,6 @@ import io
 import os.path
 import shutil
 import sys
-import tempfile
 import uuid
 import zipfile
 
@@ -44,8 +43,8 @@ def get_drive_client(authentication_token):
 
 def get_path_on_drive(file_path):
     if os.path.isabs(file_path):
-        return tempfile.gettempdir() + file_path
-    return tempfile.gettempdir() + '/' + file_path
+        return '/tmp' + file_path
+    return '/tmp/' + file_path
 
 def get_file_id(drive, file_path):
     path_on_drive = get_path_on_drive(file_path)
@@ -126,7 +125,7 @@ def download(args):
 
     request = drive.files().get_media(fileId=maybe_id, acknowledgeAbuse=True)
 
-    path_in_tmp = tempfile.gettempdir() + '/' + str(uuid.uuid4())
+    path_in_tmp = '/tmp/' + str(uuid.uuid4())
     with io.FileIO(path_in_tmp, mode='wb') as stream_input:
         downloader = MediaIoBaseDownload(stream_input, request)
         done = False