=== added file 'include/unity/util/SnapPath.h'
--- include/unity/util/SnapPath.h	1970-01-01 00:00:00 +0000
+++ include/unity/util/SnapPath.h	2017-03-28 18:46:38 +0000
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2016-2017 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#include <string>
+
+namespace unity
+{
+
+namespace util
+{
+
+    std::string prepend_snap_path(const std::string& path);
+
+} // namespace util
+
+} // namespace unity

=== modified file 'src/unity/util/CMakeLists.txt'
--- src/unity/util/CMakeLists.txt	2013-06-06 11:43:49 +0000
+++ src/unity/util/CMakeLists.txt	2017-03-28 18:46:38 +0000
@@ -4,6 +4,7 @@
     ${CMAKE_CURRENT_SOURCE_DIR}/Daemon.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/FileIO.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/IniParser.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/SnapPath.cpp
 )
 
 set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${UTIL_SRC} PARENT_SCOPE)

=== added file 'src/unity/util/SnapPath.cpp'
--- src/unity/util/SnapPath.cpp	1970-01-01 00:00:00 +0000
+++ src/unity/util/SnapPath.cpp	2017-03-28 18:46:38 +0000
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2016-2017 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "unity/util/SnapPath.h"
+
+namespace unity
+{
+
+namespace util
+{
+
+std::string prepend_snap_path(const std::string& path)
+{
+    const char* env_snap = getenv("SNAP");
+    if (env_snap == nullptr) {
+        return path;
+    }
+    return env_snap + path;
+}
+
+} // namespace util
+
+} // namespace unity

=== modified file 'test/gtest/unity/util/CMakeLists.txt'
--- test/gtest/unity/util/CMakeLists.txt	2017-01-19 13:52:32 +0000
+++ test/gtest/unity/util/CMakeLists.txt	2017-03-28 18:46:38 +0000
@@ -5,4 +5,5 @@
 add_subdirectory(GObjectMemory)
 add_subdirectory(IniParser)
 add_subdirectory(ResourcePtr)
+add_subdirectory(SnapPath)
 add_subdirectory(internal)

=== added directory 'test/gtest/unity/util/SnapPath'
=== added file 'test/gtest/unity/util/SnapPath/CMakeLists.txt'
--- test/gtest/unity/util/SnapPath/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ test/gtest/unity/util/SnapPath/CMakeLists.txt	2017-03-28 18:46:38 +0000
@@ -0,0 +1,4 @@
+add_executable(SnapPath_test SnapPath_test.cpp)
+target_link_libraries(SnapPath_test ${LIBS} ${TESTLIBS})
+
+add_test(SnapPath SnapPath_test)

=== added file 'test/gtest/unity/util/SnapPath/SnapPath_test.cpp'
--- test/gtest/unity/util/SnapPath/SnapPath_test.cpp	1970-01-01 00:00:00 +0000
+++ test/gtest/unity/util/SnapPath/SnapPath_test.cpp	2017-03-28 18:46:38 +0000
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2016-2017 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "unity/util/SnapPath.h"
+
+#include <gtest/gtest.h>
+
+using namespace unity::util;
+
+namespace {
+
+TEST(Utilities, testPrependSnapPathSet) {
+    ASSERT_EQ(0, setenv("SNAP", "/snap", 1));
+    EXPECT_EQ("/snap/bar", prepend_snap_path("/bar"));
+    ASSERT_EQ(0, unsetenv("SNAP"));
+}
+
+TEST(Utilities, testPrependSnapPathUnset) {
+    ASSERT_EQ(0, unsetenv("SNAP"));
+    EXPECT_EQ("/bar", prepend_snap_path("/bar"));
+}
+
+} // namespace

