Skip to content

Commit 0d179c8

Browse files
committed
mytharchivehelper/main.cpp: use FileSystemInfo
instead of duplicating its code.
1 parent d2e2ad9 commit 0d179c8

File tree

1 file changed

+2
-23
lines changed
  • mythplugins/mytharchive/mytharchivehelper

1 file changed

+2
-23
lines changed

mythplugins/mytharchive/mytharchivehelper/main.cpp

+2-23
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@
3030
#include <sys/wait.h> // for WIFEXITED and WEXITSTATUS
3131
#include <unistd.h>
3232

33-
#include <QtGlobal>
34-
#if defined(Q_OS_DARWIN) or defined(__FreeBSD__)
35-
#include <sys/param.h>
36-
#include <sys/mount.h>
37-
#elif defined(__linux__)
38-
#include <sys/vfs.h>
39-
#endif
40-
4133
// Qt headers
4234
#include <QApplication>
4335
#include <QFile>
@@ -49,9 +41,9 @@
4941
#include <QTextStream>
5042

5143
// MythTV headers
44+
#include <filesysteminfo.h>
5245
#include <mythcommandlineparser.h>
5346
#include <mythmiscutil.h>
54-
#include <mythcoreutil.h>
5547
#include <mythcontext.h>
5648
#include <mythversion.h>
5749
#include <exitcodes.h>
@@ -2237,21 +2229,8 @@ static int isRemote(const QString& filename)
22372229
if (!QFile::exists(filename))
22382230
return 0;
22392231

2240-
// TODO replace with FileSystemInfo?
2241-
#ifdef Q_OS_DARWIN
2242-
struct statfs statbuf {};
2243-
if ((statfs(qPrintable(filename), &statbuf) == 0) &&
2244-
((!strcmp(statbuf.f_fstypename, "nfs")) || // NFS|FTP
2245-
(!strcmp(statbuf.f_fstypename, "afpfs")) || // ApplShr
2246-
(!strcmp(statbuf.f_fstypename, "smbfs")))) // SMB
2232+
if (!FileSystemInfo(QString(), filename).isLocal())
22472233
return 2;
2248-
#elif defined(__linux__)
2249-
struct statfs statbuf {};
2250-
if ((statfs(qPrintable(filename), &statbuf) == 0) &&
2251-
((statbuf.f_type == 0x6969) || // NFS
2252-
(statbuf.f_type == 0x517B))) // SMB
2253-
return 2;
2254-
#endif
22552234

22562235
return 1;
22572236
}

0 commit comments

Comments
 (0)