# HG changeset patch
# User Andrey Skvortsov <andrej.skvortzov@gmail.com>
# Date 1492682505 -10800
# Node ID 6db967480b7db9c4999b7516770a381e86670f92
# Parent  2fcea15858a5b76d78b5fbc27f8650c41f76b908
make run Beremiz and PLCOpen Editor, if full path contain non-lating
characters

There was a problem in About dialog and in project properites tab and
probably in my other places, when str is automatically converted to
unicode string using ascii.
This patch converts str to unicode using proper encoding at the very beggining.

diff -r 2fcea15858a5 -r 6db967480b7d Beremiz.py
--- a/Beremiz.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/Beremiz.py	Thu Apr 20 13:01:45 2017 +0300
@@ -27,12 +27,13 @@
 import os, sys, getopt
 import time
 import __builtin__
+import util.paths as paths
 
 class BeremizIDELauncher:
     def __init__(self):
         self.updateinfo_url = None
         self.extensions = []
-        self.app_dir = os.path.dirname(os.path.realpath(__file__))
+        self.app_dir = paths.AbsDir(__file__)
         self.projectOpen = None
         self.buildpath = None
         self.splash = None
diff -r 2fcea15858a5 -r 6db967480b7d BeremizIDE.py
--- a/BeremizIDE.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/BeremizIDE.py	Thu Apr 20 13:01:45 2017 +0300
@@ -30,9 +30,10 @@
 import random
 import time
 import version
+import util.paths as paths
 from types import ListType
 
-beremiz_dir = os.path.dirname(os.path.realpath(__file__))
+beremiz_dir = paths.AbsDir(__file__)
 
 def Bpath(*args):
     return os.path.join(beremiz_dir,*args)
diff -r 2fcea15858a5 -r 6db967480b7d Beremiz_service.py
--- a/Beremiz_service.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/Beremiz_service.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -96,7 +97,8 @@
         usage()
         sys.exit()
 
-beremiz_dir = os.path.dirname(os.path.realpath(__file__))
+import util.paths as paths
+beremiz_dir = paths.AbsDir(__file__)
 
 if len(argv) > 1:
     usage()
diff -r 2fcea15858a5 -r 6db967480b7d NativeLib.py
--- a/NativeLib.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/NativeLib.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -23,9 +24,10 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 import os
+import util.paths as paths
 from POULibrary import POULibrary
 
 class NativeLibrary(POULibrary):
     def GetLibraryPath(self):
-        return os.path.join(os.path.split(__file__)[0], "NativeLib.xml") 
+        return paths.AbsNeighbourFile(__file__, "NativeLib.xml") 
 
diff -r 2fcea15858a5 -r 6db967480b7d PLCControler.py
--- a/PLCControler.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/PLCControler.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -28,6 +29,7 @@
 from copy import deepcopy
 import os,sys,re
 import datetime
+import util.paths as paths
 from time import localtime
 from collections import OrderedDict, namedtuple
 
@@ -88,7 +90,7 @@
                    LOCATION_VAR_OUTPUT,
                    LOCATION_VAR_MEMORY] = range(6)
 
-ScriptDirectory = os.path.split(os.path.realpath(__file__))[0]
+ScriptDirectory = paths.AbsDir(__file__)
 
 def GetUneditableNames():
     _ = lambda x:x
diff -r 2fcea15858a5 -r 6db967480b7d PLCOpenEditor.py
--- a/PLCOpenEditor.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/PLCOpenEditor.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -25,8 +26,9 @@
 import wx
 import os, sys, platform, time, traceback, getopt
 import version
-
-beremiz_dir = os.path.dirname(os.path.realpath(__file__))
+import util.paths as paths
+
+beremiz_dir = paths.AbsDir(__file__)
 
 __version__ = "$Revision: 1.130 $"
 
diff -r 2fcea15858a5 -r 6db967480b7d ProjectController.py
--- a/ProjectController.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/ProjectController.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -41,6 +42,7 @@
 
 import targets
 import connectors
+import util.paths as paths
 from util.misc import CheckPathPerm, GetClassImporter
 from util.MiniTextControler import MiniTextControler
 from util.ProcessLogger import ProcessLogger
@@ -56,7 +58,7 @@
 from targets.typemapping import UnpackDebugBuffer
 from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage
 
-base_folder = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
+base_folder = paths.AbsParentDir(__file__)
 
 MATIEC_ERROR_MODEL = re.compile(".*\.st:(\d+)-(\d+)\.\.(\d+)-(\d+): (?:error)|(?:warning) : (.*)$")
 
@@ -567,7 +569,7 @@
         return children
 
     def ConfNodePath(self):
-        return os.path.split(__file__)[0]
+        return paths.AbsDir(__file__)
 
     def CTNPath(self, CTNName=None):
         return self.ProjectPath
diff -r 2fcea15858a5 -r 6db967480b7d canfestival/canfestival.py
--- a/canfestival/canfestival.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/canfestival/canfestival.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -23,8 +24,9 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 import os, sys, shutil
-
-base_folder = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
+import util.paths as paths
+
+base_folder = paths.AbsParentDir(__file__, 2)
 CanFestivalPath = os.path.join(base_folder, "CanFestival-3")
 sys.path.append(os.path.join(CanFestivalPath, "objdictgen"))
 
@@ -579,7 +581,7 @@
             format_dict["nodes_close"] += 'NODE_CLOSE(%s)\n    '%(nodename)
             format_dict["nodes_stop"] += 'NODE_STOP(%s)\n    '%(nodename)
         
-        filename = os.path.join(os.path.split(__file__)[0],"cf_runtime.c")
+        filename = paths.AbsNeighbourFile(__file__,"cf_runtime.c")
         cf_main = open(filename).read() % format_dict
         cf_main_path = os.path.join(buildpath, "CF_%(locstr)s.c"%format_dict)
         f = open(cf_main_path,'w')
diff -r 2fcea15858a5 -r 6db967480b7d connectors/__init__.py
--- a/connectors/__init__.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/connectors/__init__.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -25,9 +26,9 @@
 # Package initialisation
 
 from os import listdir, path
+import util.paths as paths
 
-
-_base_path = path.split(__file__)[0]
+_base_path = paths.AbsDir(__file__)
 
 
 def _GetLocalConnectorClassFactory(name):
diff -r 2fcea15858a5 -r 6db967480b7d plcopen/definitions.py
--- a/plcopen/definitions.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/plcopen/definitions.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -24,7 +25,8 @@
 
 
 from os.path import join, split, realpath
-sd = split(realpath(__file__))[0]
+import util.paths as paths
+sd = paths.AbsDir(__file__)
 
 # Override gettext _ in this module
 # since we just want string to be added to dictionnary
diff -r 2fcea15858a5 -r 6db967480b7d plcopen/plcopen.py
--- a/plcopen/plcopen.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/plcopen/plcopen.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -27,6 +28,7 @@
 import os, re
 from lxml import etree
 from collections import OrderedDict
+import util.paths as paths
 
 """
 Dictionary that makes the relation between var names in plcopen and displayed values
@@ -132,7 +134,7 @@
 def TextMatched(str1, str2):
     return str1 and str2 and (str1.upper() == str2.upper())
 
-PLCOpenParser = GenerateParserFromXSD(os.path.join(os.path.split(__file__)[0], "tc6_xml_v201.xsd"))
+PLCOpenParser = GenerateParserFromXSD(paths.AbsNeighbourFile(__file__, "tc6_xml_v201.xsd"))
 PLCOpen_XPath = lambda xpath: etree.XPath(xpath, namespaces=PLCOpenParser.NSMAP)
 
 LOAD_POU_PROJECT_TEMPLATE = """
@@ -167,7 +169,7 @@
   </body>
 </pou>""" % locals()
 
-PLCOpen_v1_file = open(os.path.join(os.path.split(__file__)[0], "TC6_XML_V10_B.xsd"))
+PLCOpen_v1_file = open(paths.AbsNeighbourFile(__file__, "TC6_XML_V10_B.xsd"))
 PLCOpen_v1_xml = PLCOpen_v1_file.read()
 PLCOpen_v1_file.close()
 PLCOpen_v1_xml = PLCOpen_v1_xml.replace(
diff -r 2fcea15858a5 -r 6db967480b7d py_ext/PythonFileCTNMixin.py
--- a/py_ext/PythonFileCTNMixin.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/py_ext/PythonFileCTNMixin.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -24,6 +25,7 @@
 
 import os, re
 from lxml import etree
+import util.paths as paths
 
 from xmlclass import GenerateParserFromXSD
 
@@ -47,8 +49,7 @@
         filepath = self.PythonFileName()
 
         if os.path.isfile(filepath):
-            PythonParser = GenerateParserFromXSD(
-                os.path.join(os.path.dirname(__file__), "py_ext_xsd.xsd"))
+            PythonParser = GenerateParserFromXSD(paths.AbsNeighbourFile(__file__, "py_ext_xsd.xsd"))
 
             xmlfile = open(filepath, 'r')
             pythonfile_xml = xmlfile.read()
diff -r 2fcea15858a5 -r 6db967480b7d py_ext/py_ext.py
--- a/py_ext/py_ext.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/py_ext/py_ext.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -25,15 +26,15 @@
 import os
 from POULibrary import POULibrary
 from PythonFileCTNMixin import PythonFileCTNMixin
+import util.paths as paths
 
 class PythonLibrary(POULibrary):
     def GetLibraryPath(self):
-        return os.path.join(os.path.split(__file__)[0], "pous.xml") 
+        return paths.AbsNeighbourFile(__file__, "pous.xml") 
 
     def Generate_C(self, buildpath, varlist, IECCFLAGS):
         
-        plc_python_filepath = os.path.join(
-            os.path.split(__file__)[0], "plc_python.c")
+        plc_python_filepath = paths.AbsNeighbourFile(__file__, "plc_python.c")
         plc_python_file = open(plc_python_filepath, 'r')
         plc_python_code = plc_python_file.read()
         plc_python_file.close()
diff -r 2fcea15858a5 -r 6db967480b7d runtime/NevowServer.py
--- a/runtime/NevowServer.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/runtime/NevowServer.py	Thu Apr 20 13:01:45 2017 +0300
@@ -4,6 +4,7 @@
 # This file is part of Beremiz runtime.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING.Runtime file for copyrights details.
 #
@@ -22,6 +23,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 import os
+import util.paths as paths
 from nevow import rend, appserver, inevow, tags, loaders, athena
 from nevow.page import renderer
 from twisted.python import util
@@ -122,7 +124,7 @@
 
     def __init__(self, plcState=False, *a, **kw):
         super(WebInterface, self).__init__(*a, **kw)
-        self.jsModules.mapping[u'WebInterface'] = util.sibpath(__file__, 'webinterface.js')
+        self.jsModules.mapping[u'WebInterface'] = paths.AbsNeighbourFile(__file__), 'webinterface.js')
         self.plcState = plcState
         self.MainPage.setPLCState(plcState)
 
diff -r 2fcea15858a5 -r 6db967480b7d svgui/svgui.py
--- a/svgui/svgui.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/svgui/svgui.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -27,13 +28,14 @@
 
 from pyjs import translate
 
+import util.paths as paths
 from POULibrary import POULibrary
 from docutil import open_svg
 from py_ext import PythonFileCTNMixin
 
 class SVGUILibrary(POULibrary):
     def GetLibraryPath(self):
-        return os.path.join(os.path.split(__file__)[0], "pous.xml") 
+        return paths.AbsNeighbourFile(__file__, "pous.xml") 
 
 class SVGUI(PythonFileCTNMixin):
 
@@ -49,7 +51,7 @@
     ]
 
     def ConfNodePath(self):
-        return os.path.join(os.path.dirname(__file__))
+        return paths.AbsDir(__file__)
 
     def _getSVGpath(self, project_path=None):
         if project_path is None:
@@ -58,7 +60,7 @@
         return os.path.join(project_path, "gui.svg")
 
     def _getSVGUIserverpath(self):
-        return os.path.join(os.path.dirname(__file__), "svgui_server.py")
+        return paths.AbsNeighbourFile(__file__, "svgui_server.py")
 
     def OnCTNSave(self, from_project_path=None):
         if from_project_path is not None:
@@ -90,13 +92,14 @@
 
         svguilibpath = os.path.join(self._getBuildPath(), "svguilib.js")
         svguilibfile = open(svguilibpath, 'w')
-        svguilibfile.write(translate(os.path.join(os.path.dirname(__file__), "pyjs", "lib", "sys.py"), "sys"))
-        svguilibfile.write(open(os.path.join(os.path.dirname(__file__), "pyjs", "lib", "_pyjs.js"), 'r').read())
-        svguilibfile.write(translate(os.path.join(os.path.dirname(__file__), "pyjs", "lib", "pyjslib.py"), "pyjslib"))
-        svguilibfile.write(translate(os.path.join(os.path.dirname(__file__), "svguilib.py"), "svguilib"))
+        fpath=paths.AbsDir(__file__)
+        svguilibfile.write(translate(os.path.join(fpath, "pyjs", "lib", "sys.py"), "sys"))
+        svguilibfile.write(open(os.path.join(fpath, "pyjs", "lib", "_pyjs.js"), 'r').read())
+        svguilibfile.write(translate(os.path.join(fpath, "pyjs", "lib", "pyjslib.py"), "pyjslib"))
+        svguilibfile.write(translate(os.path.join(fpath, "svguilib.py"), "svguilib"))
         svguilibfile.write("pyjslib();\nsvguilib();\n")
-        svguilibfile.write(open(os.path.join(os.path.dirname(__file__), "pyjs", "lib", "json.js"), 'r').read())
-        svguilibfile.write(open(os.path.join(os.path.dirname(__file__), "livesvg.js"), 'r').read())
+        svguilibfile.write(open(os.path.join(fpath, "pyjs", "lib", "json.js"), 'r').read())
+        svguilibfile.write(open(os.path.join(fpath, "livesvg.js"), 'r').read())
         svguilibfile.close()
         jsmodules = {"LiveSVGPage": "svguilib.js"}
         res += (("svguilib.js", file(svguilibpath,"rb")),)
diff -r 2fcea15858a5 -r 6db967480b7d targets/__init__.py
--- a/targets/__init__.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/targets/__init__.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -34,8 +35,9 @@
 """
 
 from os import listdir, path
+import util.paths as paths
 
-_base_path = path.split(__file__)[0]
+_base_path = paths.AbsDir(__file__)
 def _GetLocalTargetClassFactory(name):
     return lambda:getattr(__import__(name,globals(),locals()), name+"_target")
 
@@ -78,10 +80,10 @@
     return code
 
 def GetHeader():
-    filename = path.join(path.split(__file__)[0],"beremiz.h")
+    filename = paths.AbsNeighbourFile(__file__,"beremiz.h")
     return open(filename).read()
 
 def GetCode(name):
-    filename = path.join(path.split(__file__)[0],name)
+    filename = paths.AbsNeighbourFile(__file__,name)
     return open(filename).read()
 
diff -r 2fcea15858a5 -r 6db967480b7d util/paths.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/util/paths.py	Thu Apr 20 13:01:45 2017 +0300
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# This file is part of Beremiz, a Integrated Development Environment for
+# programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
+#
+# Copyright (C) 2017: Andrey Skvortsov
+#
+# See COPYING file for copyrights details.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+import os, sys
+
+def AbsFile(file):
+    if isinstance(file, str):
+        file = unicode(file,sys.getfilesystemencoding())
+    return file
+
+def AbsDir(file):
+    file = AbsFile(file)
+    return os.path.dirname(os.path.realpath(file))
+
+def AbsNeighbourFile(file, *args):
+    return os.path.join(AbsDir(file), *args)
+
+
+def AbsParentDir(file, level = 1):
+    path = AbsDir(file)
+    for i in range(0, level):
+        path = os.path.dirname(path)
+    return path
diff -r 2fcea15858a5 -r 6db967480b7d version.py
--- a/version.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/version.py	Thu Apr 20 13:01:45 2017 +0300
@@ -24,10 +24,11 @@
 
 
 import subprocess, os
+import util.paths as paths
 
 def GetAppRevision():
     rev = None
-    app_dir=os.path.dirname(os.path.realpath(__file__))    
+    app_dir=paths.AbsDir(__file__)
     try:
         pipe = subprocess.Popen(
             ["hg", "id", "-i"],
@@ -88,8 +89,8 @@
     '')
 
     # read license file
-    path=os.path.join(os.path.dirname(os.path.abspath(__file__)))
-    license_path = os.path.join(path, u"COPYING")
+    path=paths.AbsDir(__file__)
+    license_path = os.path.join(path, "COPYING")
     license=''
     if os.path.exists(license_path):
         with open(license_path) as f:
diff -r 2fcea15858a5 -r 6db967480b7d wxglade_hmi/wxglade_hmi.py
--- a/wxglade_hmi/wxglade_hmi.py	Wed Apr 12 10:20:01 2017 +0000
+++ b/wxglade_hmi/wxglade_hmi.py	Thu Apr 20 13:01:45 2017 +0300
@@ -5,6 +5,7 @@
 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
 #
 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+# Copyright (C) 2017: Andrey Skvortsov
 #
 # See COPYING file for copyrights details.
 #
@@ -26,6 +27,7 @@
 import os, sys, shutil
 from xml.dom import minidom
 
+import util.paths as paths
 from py_ext import PythonFileCTNMixin
 
 class WxGladeHMI(PythonFileCTNMixin):
@@ -41,7 +43,7 @@
         return "wxGlade"
 
     def ConfNodePath(self):
-        return os.path.join(os.path.dirname(__file__))
+        return paths.AbsDir(__file__)
 
     def _getWXGLADEpath(self, project_path=None):
         if project_path is None: