From a7f31b56af67792407e383982284969f01500407 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 5 Mar 2012 00:34:21 +0000 Subject: Add new inodes_same() method. git-svn-id: svn://localhost/ardour2/branches/3.0@11590 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/utils.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libs/ardour/utils.cc') diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 1c52a6f638..4933cd7e5c 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -765,6 +765,18 @@ double slider_position_to_gain_with_max (double g, double max_gain) return slider_position_to_gain (g * max_gain/2.0); } +/** @return true if files a and b have the same inode */ +bool +inodes_same (const string& a, const string& b) +{ + struct stat bA; + int const rA = stat (a.c_str(), &bA); + struct stat bB; + int const rB = stat (b.c_str(), &bB); + + return (rA == 0 && rB == 0 && bA.st_ino == bB.st_ino); +} + extern "C" { void c_stacktrace() { stacktrace (cerr); } } -- cgit v1.2.3