From patchwork Fri Jan 27 22:01:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barker X-Patchwork-Id: 6427 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 61ADC249C6 for ; Fri, 27 Jan 2012 22:01:15 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 51C69A181C0 for ; Fri, 27 Jan 2012 22:01:15 +0000 (UTC) Received: by mail-bk0-f52.google.com with SMTP id r19so2384099bka.11 for ; Fri, 27 Jan 2012 14:01:15 -0800 (PST) Received: by 10.205.134.129 with SMTP id ic1mr3854029bkc.92.1327701675130; Fri, 27 Jan 2012 14:01:15 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.130.220 with SMTP id u28cs86286bks; Fri, 27 Jan 2012 14:01:14 -0800 (PST) Received: by 10.180.84.105 with SMTP id x9mr14312758wiy.19.1327701672941; Fri, 27 Jan 2012 14:01:12 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id e21si3597992wed.115.2012.01.27.14.01.12 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Jan 2012 14:01:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Rqtr6-00025T-NQ for ; Fri, 27 Jan 2012 22:01:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id A7262E0A5B for ; Fri, 27 Jan 2012 22:01:12 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: libmatrix X-Launchpad-Branch: ~jesse-barker/libmatrix/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 36 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~jesse-barker/libmatrix/trunk] Rev 36: Add a member to Util to return just the program name from a path string. Message-Id: <20120127220112.30014.50925.launchpad@ackee.canonical.com> Date: Fri, 27 Jan 2012 22:01:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14727"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 485e4d6bbd1d68832bed771c0fb96390a9587cf0 ------------------------------------------------------------ revno: 36 committer: Jesse Barker branch nick: trunk timestamp: Fri 2012-01-27 13:58:38 -0800 message: Add a member to Util to return just the program name from a path string. modified: util.cc util.h --- lp:libmatrix https://code.launchpad.net/~jesse-barker/libmatrix/trunk You are subscribed to branch lp:libmatrix. To unsubscribe from this branch go to https://code.launchpad.net/~jesse-barker/libmatrix/trunk/+edit-subscription === modified file 'util.cc' --- util.cc 2011-12-09 00:59:12 +0000 +++ util.cc 2012-01-27 21:58:38 +0000 @@ -49,6 +49,18 @@ return now; } +std::string +Util::appname_from_path(const std::string& path) +{ + std::string::size_type slashPos = path.rfind("/"); + std::string::size_type startPos(0); + if (slashPos != std::string::npos) + { + startPos = slashPos + 1; + } + return std::string(path, startPos, std::string::npos); +} + #ifndef ANDROID std::istream * === modified file 'util.h' --- util.h 2011-12-09 00:59:12 +0000 +++ util.h 2012-01-27 21:58:38 +0000 @@ -57,7 +57,8 @@ ss << t; return ss.str(); } - + static std::string + appname_from_path(const std::string& path); #ifdef ANDROID static void android_set_asset_manager(AAssetManager *asset_manager);