From c0aeb567ce6f98f94e85943e2be5cdeb0c3ea2a7 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 22 Sep 2008 09:44:44 +0000 Subject: [PATCH] add FileName::extension() method. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26494 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/FileName.cpp | 6 ++++++ src/support/FileName.h | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index 5e1ae84b90..d87ab63f4b 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -302,6 +302,12 @@ string FileName::onlyFileNameWithoutExt() const } +string FileName::extension() const +{ + return fromqstr(d->fi.suffix()); +} + + FileName FileName::onlyPath() const { FileName path; diff --git a/src/support/FileName.h b/src/support/FileName.h index 0b65eb1f25..1c020c898f 100644 --- a/src/support/FileName.h +++ b/src/support/FileName.h @@ -170,8 +170,10 @@ public: /// filename without path std::string onlyFileName() const; - /// filename without path and without extension - std::string onlyFileNameWithoutExt() const; + /// filename without path and without extension + std::string onlyFileNameWithoutExt() const; + /// only extension after the last dot. + std::string extension() const; /// path without file name FileName onlyPath() const; /// used for display in the Gui -- 2.39.5