michael@0: // Copyright (c) 2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #include "base/mac_util.h" michael@0: michael@0: #include michael@0: #import michael@0: michael@0: #include "base/file_path.h" michael@0: #include "base/logging.h" michael@0: #include "base/scoped_cftyperef.h" michael@0: #include "base/sys_string_conversions.h" michael@0: michael@0: namespace mac_util { michael@0: michael@0: // Adapted from http://developer.apple.com/carbon/tipsandtricks.html#AmIBundled michael@0: bool AmIBundled() { michael@0: ProcessSerialNumber psn = {0, kCurrentProcess}; michael@0: michael@0: FSRef fsref; michael@0: if (GetProcessBundleLocation(&psn, &fsref) != noErr) michael@0: return false; michael@0: michael@0: FSCatalogInfo info; michael@0: if (FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &info, michael@0: NULL, NULL, NULL) != noErr) { michael@0: return false; michael@0: } michael@0: michael@0: return info.nodeFlags & kFSNodeIsDirectoryMask; michael@0: } michael@0: michael@0: } // namespace mac_util