put mktempdir to utils namespace

This commit is contained in:
Nikolay Brovko 2020-01-24 18:22:20 +03:00
parent 6803ef84a5
commit dfb09f56da
No known key found for this signature in database
GPG Key ID: 32258A3DEC9B6F07
3 changed files with 28 additions and 9 deletions

View File

@ -112,20 +112,12 @@ int download () {
}
string mktempdir () throws Error {
string temp_dir = null;
Process.spawn_command_line_sync ("mktemp -d", out temp_dir);
return temp_dir.strip ();
}
int update () {
try {
unowned string repo_url = Environment.get_variable ("YGG_UPDATE_REPO");
string temp_dir = mktempdir ();
string temp_dir = Utils.mktempdir ();
if (repo_url == null) {
repo_url = "https://git.macaw.me/plant_1312/Yggtk.git";

View File

@ -1,5 +1,6 @@
yggtk_sources = [
'main.vala',
'utils.vala',
]
yggtk = executable(

26
src/utils.vala Normal file
View File

@ -0,0 +1,26 @@
/**
* 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
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Utils {
string mktempdir () throws Error {
string temp_dir = null;
Process.spawn_command_line_sync ("mktemp -d", out temp_dir);
return temp_dir.strip ();
}
}