urlhook.cpp 1.26 KB
Newer Older
1
/*
2
 *  Copyright (C) 2004-2017 Savoir-faire Linux Inc.
3
 *
4 5
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
 *
6 7 8 9
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
10
 *
11 12 13 14
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
15
 *
16 17
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
19 20
 */

21
#include "urlhook.h"
22
#include <cstdlib>
23

24 25
namespace ring {

26
int UrlHook::runAction(const std::string &command, const std::string &args)
Emmanuel Milou's avatar
Emmanuel Milou committed
27
{
28
    //FIXME : use fork and execve, so no need to escape shell arguments
29 30
    const std::string cmd = command + (args.empty() ? "" : " ") +
                            "\"" + args + "\" &";
31 32 33 34 35
#ifndef RING_UWP
    return system(cmd.c_str());
#else
    return 0;
#endif
Emmanuel Milou's avatar
Emmanuel Milou committed
36 37
}

38
} // namespace ring