Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsiddharth jain <sija@microsoft.com>2020-11-25 10:23:19 +0300
committersiddharth jain <sija@microsoft.com>2020-11-25 10:23:19 +0300
commitc961624aa82700a642495015edc2897aefd19c79 (patch)
tree398ac2fc63c229efd5b881d5841950f8a494a0f3
parentb46da0dc507fd8bb34357647f7eae9a9cd7f49ad (diff)
env separator
-rw-r--r--moses2/Moses2Wrapper.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/moses2/Moses2Wrapper.cpp b/moses2/Moses2Wrapper.cpp
index c699bfd5e..fb59d010f 100644
--- a/moses2/Moses2Wrapper.cpp
+++ b/moses2/Moses2Wrapper.cpp
@@ -6,8 +6,14 @@ using namespace std;
namespace Moses2 {
//summary :: need to update the LM path at runtime with complete artifact path.
void Moses2Wrapper::UpdateLMPath(const std::string& filePath) {
- auto file = filePath.substr(filePath.find_last_of("\\") + 1);
- auto path = filePath.substr(0, filePath.find_last_of("\\"));
+
+ char sep = '/';
+
+ #ifdef _WIN32
+ sep = '\\';
+ #endif
+ auto file = filePath.substr(filePath.find_last_of(sep) + 1);
+ auto path = filePath.substr(0, filePath.find_last_of(sep));
auto a = m_param->GetParam("feature");
std::vector<std::string> feature;
for (int i = 0; i < a->size(); i++) {
@@ -17,7 +23,7 @@ namespace Moses2 {
for (int k = 0; k < abc.size(); k++) {
if (abc.at(k).find("path=") != string::npos) {
auto lm = abc.at(k).substr(abc.at(k).find_last_of("=") + 1);
- s = s + "path=" + path + "\\" + lm + " ";
+ s = s + "path=" + path + sep + lm + " ";
}
else {
s = s + abc.at(k) + " ";