1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "gn/frameworks_utils.h" 6 7 #include "gn/filesystem_utils.h" 8 9 namespace { 10 11 // Name of the extension of frameworks. 12 const char kFrameworkExtension[] = "framework"; 13 14 } // anonymous namespace 15 GetFrameworkName(const std::string & file)16std::string_view GetFrameworkName(const std::string& file) { 17 if (FindFilenameOffset(file) != 0) 18 return std::string_view(); 19 20 std::string_view extension = FindExtension(&file); 21 if (extension != kFrameworkExtension) 22 return std::string_view(); 23 24 return FindFilenameNoExtension(&file); 25 } 26