diff --git a/meta-oniro-staging/classes/gn_base.bbclass b/meta-oniro-staging/classes/gn_base.bbclass
index 6f0c945a73bd6bbb53c5a0a3b749030d24570342..e16f084b172e518c80f430d78e316d3b6c517653 100644
--- a/meta-oniro-staging/classes/gn_base.bbclass
+++ b/meta-oniro-staging/classes/gn_base.bbclass
@@ -52,7 +52,7 @@ EXPORT_FUNCTIONS do_configure do_compile do_install
 python do_check_B_is_not_S() {
     bpath = os.path.abspath(d.expand("${B}"))
     spath = os.path.abspath(d.expand("${S}"))
-    if os.path.abspath(d.expand("${S}")) == os.path.abspath(d.expand("${B}")):
+    if bpath == spath:
         bb.fatal('''
 GN requires build and sources directories to be different. By default build
 directory is set to ${WORKDIR}/out. If you're using devtool remember to use