Project

General

Profile

整備 #4424

rtc.confのデフォルトファイルパス

Added by n-miyamoto almost 4 years ago. Updated about 3 years ago.

Status:
終了
Priority:
通常
Assignee:
Target version:
-
Start date:
01/19/2018
Due date:
% Done:

100%

Estimated time:

Description

rtc.confのデフォルトファイルパスが以下のようになっているため、WindowsとLinuxで場合分けする。


Related issues

Related to OpenRTM-aist (Java) - 整備 #4444: rtc.confのデフォルトファイルパス担当2018-01-29

Associated revisions

Revision 923 (diff)
Added by miyamoto almost 4 years ago

[compat, bugfix, ->RELENG_1_2] refs #4424

Revision 924 (diff)
Added by miyamoto almost 4 years ago

[compat, bugfix, ->RELENG_1_2] refs #4424

Revision 926 (diff)
Added by miyamoto almost 4 years ago

[compat, bugfix, ->RELENG_1_2] refs #4424

Revision 927 (diff)
Added by miyamoto almost 4 years ago

[compat, bugfix, ->RELENG_1_2] refs #4424

History

#1 Updated by n-miyamoto almost 4 years ago

  config_file_path = ["./rtc.conf",
                      "/etc/rtc.conf",
                      "/etc/rtc/rtc.conf",
                      "/usr/local/etc/rtc.conf",
                      "/usr/local/etc/rtc/rtc.conf",
                      None]

#2 Updated by n-miyamoto almost 4 years ago

  • Status changed from 新規 to 解決
  • Assignee set to n-miyamoto
  • % Done changed from 0 to 100

Windowsの場合は環境変数RTM_ROOTから探索するように場合分けをしました。

  if sys.platform == 'win32':

    config_file_path = ["./rtc.conf",
                        "${RTM_ROOT}/bin/${RTM_VC_VERSION}/rtc.conf",
                        "C:/Python"+str(sys.version_info[0])+str(sys.version_info[1])+"/rtc.conf",
                        None]
  else:
    config_file_path = ["./rtc.conf",
                        "/etc/rtc.conf",
                        "/etc/rtc/rtc.conf",
                        "/usr/local/etc/rtc.conf",
                        "/usr/local/etc/rtc/rtc.conf",
                        None]

またStringUtil.pyに環境変数を置き換えるreplaceEnv関数を追加しました。

def replaceEnv(_str):
    tmp = _str.split("${")
    if len(tmp) < 2:
        return _str
    ret = []
    for v in tmp:
        tmp2 = v.split("}")
        if len(tmp2) == 2:
            if tmp2[0] in os.environ:
                ret.append(os.environ[tmp2[0]])
            ret.append(tmp2[1])

        else:
            ret.append(v)
    ret_str = "" 
    for s in ret:
        ret_str = ret_str + s
    return ret_str

#3 Updated by katami almost 4 years ago

  • Related to 整備 #4444: rtc.confのデフォルトファイルパス added

#4 Updated by n-miyamoto about 3 years ago

  • Status changed from 解決 to 終了

Also available in: Atom PDF