diff --git a/common/path.cpp b/common/path.cpp index daaac85f3c6..7adb03e01b3 100644 --- a/common/path.cpp +++ b/common/path.cpp @@ -276,6 +276,20 @@ Path Path::punycodeDecode() const { return ret; } +Path Path::joinComponents(const StringArray& c) { + String res; + + for (uint i = 0; i < c.size(); i++) { + res += c[i]; + if (i + 1 < c.size()) + res += DIR_SEPARATOR; + } + + Path ret; + ret._str = res; + return ret; +} + // See getIdentifierString() for more details. // This does the same but for a single path component and is used by // getIdentifierString(). diff --git a/common/path.h b/common/path.h index 8145bd2d6ac..3d3a5f087e3 100644 --- a/common/path.h +++ b/common/path.h @@ -215,6 +215,12 @@ public: * 2 separots follow each other */ StringArray splitComponents() const; + + + /** + * Opposite of splitComponents + */ + static Path joinComponents(const StringArray& c); }; /** @} */