Skip to content

Commit

Permalink
Added HOME_PATH determination using Windows API. It's required to handle
Browse files Browse the repository at this point in the history
cases when user directory contains non-ascii characters.
  • Loading branch information
Alexei Gladkikh committed Dec 6, 2015
1 parent fbde7bc commit 8311b39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion OptolithiumC/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_POLICY(SET CMP0015 NEW)
CMAKE_POLICY(SET CMP0054 OLD)
IF (WIN32)
CMAKE_POLICY(SET CMP0054 OLD)
ENDIF()

SET(CMAKE_BUILD_TYPE "Release")
SET(BUILD_DIR "build")
Expand Down
9 changes: 8 additions & 1 deletion OptolithiumGui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import logging as module_logging
import sys
import helpers
import ctypes


__author__ = 'Alexei Gladkikh'
Expand Down Expand Up @@ -113,7 +114,13 @@

KLAYOUT_PATH = "klayout"

HOME_PATH = os.path.expanduser("~")
if sys.platform == nt:
buf = ctypes.create_unicode_buffer(1024)
ctypes.windll.kernel32.GetEnvironmentVariableW(u"USERPROFILE", buf, 1024)
HOME_PATH = buf.value
else:
HOME_PATH = os.path.expanduser("~")

APPLICATION_DIRECTORY = "." + APPLICATION_NAME
CONFIG_NAME = "config.json"

Expand Down

0 comments on commit 8311b39

Please sign in to comment.