#include <wangle/client/persistence/test/TestUtil.h>

namespace wangle {

std::string getPersistentCacheFilename() {
  char filename[] = "/tmp/fbtls.XXXXXX";
  int fd = mkstemp(filename);
  close(fd);
  EXPECT_TRUE(unlink(filename) != -1);
  return std::string(filename);
}

}

/*
 *  Copyright (c) 2016, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */
#include <wangle/client/persistence/test/TestUtil.h>

#include <folly/experimental/TestUtil.h>

namespace wangle {

std::string getPersistentCacheFilename() {
  folly::test::TemporaryFile file("fbtls");
  return file.path().string();
}

}

Handle tmp dir on Android
Handle tmp dir on Android

Summary:
There is no universally accessible tmpdir on Android which
means mkstemp fails. This diff calls a function that the test runner
should provide to fill a valid temporary directory.

Reviewed By: yangchi

Differential Revision: D2842034

fb-gh-sync-id: 186c931ddf4424cb482c8fbd728ae37877017685
