From a75945a402eb2bee7bfa633f3cced735601ad727 Mon Sep 17 00:00:00 2001
From: Miikka Heikkinen <miikka.heikkinen@digia.com>
Date: Mon, 14 Jun 2010 13:44:43 +0300
Subject: Added prependEpocroot replacement function to platform_paths.prf

This function can be used to do smart prepending of epocroot to paths
defined by platform_paths.prf, though it'll work for any string.

This is useful because paths defined in platform_paths.prf can start
either with full epocroot or just slash depending on environment.

E.g.

exists($$prependEpocroot($$MW_LAYER_PUBLIC_EXPORT_PATH(foobar.h))) {
   ...
}

Reviewed-by: Janne Koskinen
---
 mkspecs/features/symbian/platform_paths.prf | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/mkspecs/features/symbian/platform_paths.prf b/mkspecs/features/symbian/platform_paths.prf
index 0e8770d..5c190c8 100644
--- a/mkspecs/features/symbian/platform_paths.prf
+++ b/mkspecs/features/symbian/platform_paths.prf
@@ -45,8 +45,17 @@
 #         INCLUDEPATH += $$OS_LAYER_DBUS_SYSTEMINCLUDE
 #         INCLUDEPATH += $$OS_LAYER_LIBUTILITY_SYSTEMINCLUDE
 #
+#     These paths are primarily meant to be used as is in bld.inf and .mmp
+#     files, so they do not contain epocroot when using official symbian
+#     toolchains (symbian-abld or symbian-sbsv2).
+#     For makefile based mkspecs, epocroot is prepended to all paths for
+#     convenience.
 #
-#       
+#     To use paths defined here in other contexts that require epocroot to be
+#     prepended always, such as exists checks, please use prependEpocroot
+#     replacement function:
+#
+#         exists($$prependEpocroot($$MW_LAYER_PUBLIC_EXPORT_PATH(foobar.h)))
 #
 # ==============================================================================
 
@@ -472,4 +481,13 @@ exists($${EPOCROOT}epoc32/include/platform_paths.prf) {
     STLLIB_USAGE_CW_FLAGS = "-wchar_t on"
     STLLIB_USAGE_DEFINES = _WCHAR_T_DECLARED
 
+    # Smart prepend of EPOCROOT to a string
+    defineReplace(prependEpocroot) {
+        contains(1, ^$${EPOCROOT}) {
+            return($$1)
+        } else {
+            return($${EPOCROOT}$$replace(1,"^/",))
+        }
+    }
+
 }
-- 
cgit v0.12