Skip to content

Commit 95169f4

Browse files
committed
Provide actual locations to the 1Password lib
The possible list of locations is built based on operating system
1 parent ea77aa1 commit 95169f4

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/onepassword/desktop_core.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
import ctypes
22
import json
33
import os
4+
import platform
45
import base64
56
from ctypes import c_uint8, c_size_t, c_int32, POINTER, byref, c_void_p
67
from .core import UniffiCore
78
from onepassword.errors import raise_typed_exception
89

910

1011
def find_1password_lib_path():
11-
locations = [
12-
"/Users/andititu/core/target/debug/libop_sdk_ipc_client.dylib"
13-
]
12+
os_name = platform.system()
13+
14+
# Define paths based on OS
15+
if os_name == "Darwin": # macOS
16+
locations = [
17+
"/Applications/1Password.app/Contents/Frameworks/libop_sdk_ipc_client.dylib",
18+
]
19+
elif os_name == "Linux":
20+
locations = [
21+
"/usr/bin/1password/libop_sdk_ipc_client.so",
22+
"/opt/1password/libop_sdk_ipc_client.so",
23+
"/snap/bin/1password/libop_sdk_ipc_client.so",
24+
]
25+
elif os_name == "Windows":
26+
locations = [
27+
r"C:\Program Files\1Password\op_sdk_ipc_client.dll",
28+
r"C:\Program Files (x86)\1Password\op_sdk_ipc_client.dll",
29+
]
30+
else:
31+
raise OSError(f"Unsupported operating system: {os_name}")
1432

1533
for lib_path in locations:
1634
if os.path.exists(lib_path):

0 commit comments

Comments
 (0)