put mktempdir to utils namespace
This commit is contained in:
parent
6803ef84a5
commit
dfb09f56da
@ -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 () {
|
int update () {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
unowned string repo_url = Environment.get_variable ("YGG_UPDATE_REPO");
|
unowned string repo_url = Environment.get_variable ("YGG_UPDATE_REPO");
|
||||||
string temp_dir = mktempdir ();
|
string temp_dir = Utils.mktempdir ();
|
||||||
|
|
||||||
if (repo_url == null) {
|
if (repo_url == null) {
|
||||||
repo_url = "https://git.macaw.me/plant_1312/Yggtk.git";
|
repo_url = "https://git.macaw.me/plant_1312/Yggtk.git";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
yggtk_sources = [
|
yggtk_sources = [
|
||||||
'main.vala',
|
'main.vala',
|
||||||
|
'utils.vala',
|
||||||
]
|
]
|
||||||
|
|
||||||
yggtk = executable(
|
yggtk = executable(
|
||||||
|
26
src/utils.vala
Normal file
26
src/utils.vala
Normal 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 ();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user