简体   繁体   English

我们如何读取相对于Mirth Connect安装目录的位置存储的配置文件?

[英]How can we read a config file stored at a location relative to the Mirth Connect Installation directory?

How can we read a config file stored at a location relative to the Mirth Connect Installation directory? 我们如何读取相对于Mirth Connect安装目录的位置存储的配置文件?

For example if Mirth is installed in /opt/Mirth-Connect directory and I want to read a file from /opt/Mirth-Connect/conf directory without specifying the fully qualified path name. 例如,如果Mirth安装在/ opt / Mirth-Connect目录中,而我想从/ opt / Mirth-Connect / conf目录中读取文件,而不指定完全限定的路径名​​。

We are using multiple instances of Mirth for different environments which are installed on the same machine, So I can't hard code full path in channel configurations. 我们正在为安装在同一台计算机上的不同环境使用Mirth的多个实例,因此我无法在通道配置中硬编码完整路径。

You can read a config file stored at a location relative to the Mirth Connect Installation directory basically in the same way as you would read any other file, ie: 您可以按照与读取任何其他文件相同的方式来读取存储在相对于Mirth Connect安装目录的位置的配置文件,即:

var folder = new java.io.File("./conf");
var listOfFiles = folder.listFiles();

for (var i = 0; i < listOfFiles.length; i++) {
    if (listOfFiles[i].isFile()) {
        // Do what you need with the file - listOfFiles[i].getName());
     } 
}

The first line gives you a path relative to the mcserver.exe (in Windows env) installation. 第一行为您提供相对于mcserver.exe(在Windows env中)安装的路径。 Accordingly, folder = File(".") is a Mirth root folder. 因此,folder = File(“。”)是Mirth根文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM