summaryrefslogtreecommitdiff
path: root/startop/view_compiler/util.cc
diff options
context:
space:
mode:
authorEric Holk <eholk@google.com>2018-10-11 14:20:39 -0700
committerEric Holk <eholk@google.com>2018-10-22 11:13:42 -0700
commitacf3fbde8263c52317dc1dc429fbeb8d87fdaf23 (patch)
treef7dc012bb36fda233288b88faf0022990832fc11 /startop/view_compiler/util.cc
parent6730f3459004f5bd475c0d9b514beeb93627eeda (diff)
Move startop/tools/view_compiler to startop/view_compiler
This is planned to ship on device, so by convention the view_compiler should not be in a tools directory. Change-Id: I0eb03812d77ec38edc3908725acb40bacb345ecd
Diffstat (limited to 'startop/view_compiler/util.cc')
-rw-r--r--startop/view_compiler/util.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/startop/view_compiler/util.cc b/startop/view_compiler/util.cc
new file mode 100644
index 000000000000..69df41dff3d7
--- /dev/null
+++ b/startop/view_compiler/util.cc
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "util.h"
+
+using std::string;
+
+// TODO: see if we can borrow this from somewhere else, like aapt2.
+string FindLayoutNameFromFilename(const string& filename) {
+ size_t start = filename.rfind("/");
+ if (start == string::npos) {
+ start = 0;
+ } else {
+ start++; // advance past '/' character
+ }
+ size_t end = filename.find(".", start);
+
+ return filename.substr(start, end - start);
+}