Skip to content

Commit

Permalink
Merge pull request #131 from roboflow/fixWindowsConf
Browse files Browse the repository at this point in the history
Fix windows conf
  • Loading branch information
Tyler-Odenthal authored Apr 7, 2023
2 parents ae7634a + 93b7d85 commit 071bf45
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
12 changes: 10 additions & 2 deletions roboflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from roboflow.core.workspace import Workspace
from roboflow.util.general import write_line

__version__ = "1.0.2"
__version__ = "1.0.3"


def check_key(api_key, model, notebook, num_retries=0):
Expand Down Expand Up @@ -72,9 +72,17 @@ def auth(api_key):


def login(workspace=None, force=False):
os_name = os.name

if os_name == "nt":
default_path = os.getenv("USERPROFILE") + "\\roboflow\\config.json"
else:
default_path = os.getenv("HOME") + "/.config/roboflow/config.json"

# default configuration location
conf_location = os.getenv(
"ROBOFLOW_CONFIG_DIR",
default=os.getenv("HOME") + "/.config/roboflow/config.json",
default=default_path,
)

if os.path.isfile(conf_location) and not force:
Expand Down
9 changes: 8 additions & 1 deletion roboflow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ def get_conditional_configuration_variable(key, default):
string: The value of the conditional configuration variable.
"""

os_name = os.name

if os_name == "nt":
default_path = os.getenv("USERPROFILE") + "\\roboflow\\config.json"
else:
default_path = os.getenv("HOME") + "/.config/roboflow/config.json"

# default configuration location
conf_location = os.getenv(
"ROBOFLOW_CONFIG_DIR",
default=os.path.expanduser("~") + "/.config/roboflow/config.json",
default=default_path,
)

# read config file for roboflow if logged in from python or CLI
Expand Down

0 comments on commit 071bf45

Please sign in to comment.