Skip to content

Prepare polymorph home #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions polymorph/UI/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from polymorph.UI.command_parser import CommandParser
from collections import OrderedDict
import os
from os.path import dirname
# from os.path import dirname
import polymorph


Expand All @@ -21,7 +21,7 @@ class Interface(object):

def __init__(self):
self._poisoner = None
self._polym_path = dirname(polymorph.__file__)
self._polym_path = polymorph.settings.path

@staticmethod
def print_help(hdict):
Expand Down
3 changes: 3 additions & 0 deletions polymorph/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
from .settings import Settings

# PoC to create initial settings manager
settings = Settings()
16 changes: 16 additions & 0 deletions polymorph/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

class Settings (object):

def __init__(self):
self._poisoner = None
self.path = os.path.expanduser("~/.polymorph")

# TODO; Just a PoC with hardcoded dirs, integrate some kind of settings
# TODO; Ensure that all App reuse this iface._polym_path instead of redefine it
# Iterate all paths down the "~/.polymorph" to initialize it if needed
_conditions_path = ["", "conditions", "conditions/executions", "conditions/postconditions", "conditions/preconditions"]
for _path in _conditions_path:
_full_path = "{}/{}".format(self.path, _path)
if not os.path.exists(_full_path):
os.makedirs(_full_path)