diff --git a/src/fileutils.cpp b/src/fileutils.cpp
index 3295f7d2bdc54586984430eaabf1b3964f9bd6d5..d3e2dad6cf67e7fbee31fc382852c8d63f01cac2 100644
--- a/src/fileutils.cpp
+++ b/src/fileutils.cpp
@@ -89,7 +89,12 @@
 #include <pj/ctype.h>
 #include <pjlib-util/md5.h>
 
-#define USE_STD_FILESYSTEM (defined __ANDROID__ || defined _WIN32)
+#if (defined __ANDROID__ || defined _WIN32)
+#define USE_STD_FILESYSTEM 1
+#else
+#define USE_STD_FILESYSTEM 0
+#endif
+
 #if USE_STD_FILESYSTEM
 #include <filesystem>
 #endif
@@ -361,12 +366,12 @@ createFileLink(const std::string& linkFile, const std::string& target, bool hard
         createSymlink(linkFile, target);
 }
 
-std::string
-getFileExtension(const std::string& filename)
+std::string_view
+getFileExtension(std::string_view filename)
 {
-    std::string result = "";
+    std::string_view result;
     auto sep = filename.find_last_of('.');
-    if (sep != std::string::npos && sep != filename.size() - 1)
+    if (sep != std::string_view::npos && sep != filename.size() - 1)
         result = filename.substr(sep + 1);
     if (result.size() >= 8)
         return {};
diff --git a/src/fileutils.h b/src/fileutils.h
index 5af214db08d4925a67eefcc5daf5381988d767ac..3b798758b4d7d89405aeb30312af38213bda0d93 100644
--- a/src/fileutils.h
+++ b/src/fileutils.h
@@ -18,8 +18,7 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
  */
 
-#ifndef FILEUTILS_H_
-#define FILEUTILS_H_
+#pragma once
 
 #include <string>
 #include <vector>
@@ -87,7 +86,7 @@ std::chrono::system_clock::time_point writeTime(const std::string& path);
 
 void createFileLink(const std::string& src, const std::string& dest, bool hard = false);
 
-std::string getFileExtension(const std::string& filename);
+std::string_view getFileExtension(std::string_view filename);
 
 /**
  * Read content of the directory.
@@ -158,5 +157,3 @@ int accessFile(const std::string& file, int mode);
 
 } // namespace fileutils
 } // namespace jami
-
-#endif // FILEUTILS_H_