Commit 142d79f2 authored by Florian Rhiem's avatar Florian Rhiem

Merge branch 'develop'

parents 15f8d51b 32825b6b
__version_info__ = (0, 8, 2)
__version_info__ = (0, 8, 3)
__version__ = '.'.join(map(str, __version_info__))
......@@ -12,6 +12,7 @@ import logging
from datetime import datetime
from core.control import Control
from core.calculation import Calculation, CalculationSettings
import core.file
from config.configuration import config
......@@ -299,6 +300,7 @@ Note: Because the cutoff radius is stored in the global configuration, it cannot
self.options.output_directory)
for input_file in input_file_list:
try:
input_file = core.file.get_abspath(input_file)
with open(input_file) as f:
resolution = None
atom_radius = None
......
......@@ -31,6 +31,23 @@ __all__ = ["File",
logger = Logger("core.file")
logger.setstream("default", sys.stdout, Logger.WARNING)
SEARCH_PATH = None
def get_abspath(path):
"""
Return an absolute path for an input file. The difference to abspath from
os.path is that this function uses SEARCH_PATH instead of the current
working directory
"""
global SEARCH_PATH
if not os.path.isabs(path) and SEARCH_PATH is not None:
# relative paths use the SEARCH_PATH instead of the current working
# directory, as that is modified at startup. The SEARCH_PATH is set
# to the initial cwd in startBatch and startGUI.
path = os.path.join(SEARCH_PATH, path)
return os.path.abspath(path)
class FileError(Exception):
"""
......@@ -63,7 +80,7 @@ class InputFile(object):
`path` :
absolute path to the file
"""
self.path = path
self.path = get_abspath(path)
self._info = data.FileInfo()
self.inforead = False
......
......@@ -3,9 +3,11 @@
import os
from core.control import Control
from cli import Cli
import core.file
def start():
core.file.SEARCH_PATH = os.getcwd()
os.chdir(os.path.abspath(os.path.dirname(__file__)))
control = Control()
instance = Cli(control)
......
......@@ -27,6 +27,7 @@ for name in API_NAMES:
sip.setapi(name, API_VERSION)
from gui import main_window
import core.file
from core import volumes
from core.control import Control
from PyQt4 import QtGui
......@@ -37,6 +38,7 @@ import core.calculation
def start_gui():
core.file.SEARCH_PATH = os.getcwd()
os.chdir(os.path.abspath(os.path.dirname(__file__)))
app = QtGui.QApplication(sys.argv)
control = Control()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment