toolkit/xre/UIKitDirProvider.mm
author Kris Maglione <maglione.k@gmail.com>
Sat, 23 Apr 2016 20:41:14 -0700
changeset 294665 58fc5fb221e0eb4dfb23779215873fb870e980c4
parent 250954 783903e5da3b3e33a52458be4d44d5359e3d013e
child 454825 0e3b5fe32d113a4a857bf7b948921f531cca8a8e
permissions -rw-r--r--
Bug 1254194: Add a validator for custom add-on content security policies. r=billm f=aswan MozReview-Commit-ID: LtBbXBCFc32

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include <Foundation/Foundation.h>

#include "UIKitDirProvider.h"

bool GetUIKitDirectory(bool aLocal, nsACString& aUserDir)
{
  NSSearchPathDirectory directory = aLocal ? NSCachesDirectory : NSApplicationSupportDirectory;
  NSArray* paths = NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES);
  if ([paths count] == 0) {
    return false;
  }
  aUserDir = [[paths objectAtIndex:0] UTF8String];
  return true;
}