| 1 | /* |
| 2 | * File: SystemUtils.h |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: Aug 24, 2009 |
| 6 | * |
| 7 | * Copyright (c) 2009-2013 Jacob Dekel |
| 8 | * $Id: |
| 9 | * |
| 10 | * This program is free software: you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation, either version 3 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | |
| 26 | #include "SystemUtils.h"cxx . . $ `<file>/HercUtilities/SystemUtils.h`/ |
| 27 | #include "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/ |
| 28 | |
| 29 | #include <QFile> |
| 30 | |
| 31 | #include <sstream> |
| 32 | #include <sys/types.h> |
| 33 | #include <sys/stat.h> |
| 34 | #ifndef hFramework |
| 35 | #include <unistd.h> |
| 36 | #endif |
| 37 | |
| 38 | SystemUtilscxx . . $ SystemUtils#::SystemUtilscxx . . $ SystemUtils#SystemUtils(49f6e7a06ebc5aa8).() |
| 39 | { |
| 40 | } |
| 41 | |
| 42 | SystemUtilscxx . . $ SystemUtils#::~cxx . . $ SystemUtils#`~SystemUtils`(49f6e7a06ebc5aa8).SystemUtilscxx . . $ SystemUtils#() |
| 43 | { |
| 44 | } |
| 45 | |
| 46 | bool SystemUtilscxx . . $ SystemUtils#::processIsRunningcxx . . $ SystemUtils#processIsRunning(83c267b20bac841a).(int pid) |
| 47 | { |
| 48 | if (pid <= 1) return false; |
| 49 | stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# procPathcxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).;// TODO: merge with Watchdog (same function!) |
| 50 | procPath <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "/proc/" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). pid; |
| 51 | return (fileExistscxx . . $ SystemUtils#fileExists(7c222eea44a24d43).(procPath.strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).())); |
| 52 | } |
| 53 | |
| 54 | bool SystemUtilscxx . . $ SystemUtils#::fileExistscxx . . $ SystemUtils#fileExists(7c222eea44a24d43).(const stdcxx . . $ std/::stringcxx . . $ std/string# & fileName) |
| 55 | { |
| 56 | static struct stat dstat; |
| 57 | return (stat(fileName.c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).(), &dstat) == 0); |
| 58 | } |
| 59 | |
| 60 | bool SystemUtilscxx . . $ SystemUtils#::fileExistscxx . . $ SystemUtils#fileExists(e1defb592416720d).(const QStringcxx . . $ QString# & fileName) |
| 61 | { |
| 62 | return (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(fileName)); |
| 63 | } |