diff options
author | tfarina <tfarina@chromium.org> | 2014-06-18 14:32:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-18 14:32:49 -0700 |
commit | bcbc1788b478b1e54079318ad073e8490aa66fae (patch) | |
tree | 5492557ad07a5917364b69721788bc5ec471954a /tools | |
parent | 6518eaaefac27a823c55c16c12b3c698f09aabf5 (diff) |
Refactor how we handle resources path in Tests.
This idea emerged while doing https://codereview.chromium.org/321723002/
(commit 880914c35c8f7fc2e9c57134134c883baf66e538).
BUG=None
TEST=make tests && out/Debug/tests
R=mtklein@google.com
Author: tfarina@chromium.org
Review URL: https://codereview.chromium.org/346453002
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Resources.cpp | 17 | ||||
-rw-r--r-- | tools/Resources.h | 15 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tools/Resources.cpp b/tools/Resources.cpp new file mode 100644 index 0000000000..756d14ad3a --- /dev/null +++ b/tools/Resources.cpp @@ -0,0 +1,17 @@ +/* + * Copyright 2014 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "Resources.h" + +#include "SkCommandLineFlags.h" +#include "SkOSFile.h" + +DEFINE_string2(resourcePath, i, "resources", "Directory with test resources: images, fonts, etc."); + +SkString GetResourcePath(const char* resource) { + return SkOSPath::SkPathJoin(FLAGS_resourcePath[0], resource); +} diff --git a/tools/Resources.h b/tools/Resources.h new file mode 100644 index 0000000000..a10612b78d --- /dev/null +++ b/tools/Resources.h @@ -0,0 +1,15 @@ +/* + * Copyright 2014 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef Resources_DEFINED +#define Resources_DEFINED + +#include "SkString.h" + +SkString GetResourcePath(const char* resource = ""); + +#endif // Resources_DEFINED |