Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
girara
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwmt
girara
Commits
f0a64222
Commit
f0a64222
authored
Feb 24, 2019
by
Sebastian Ramacher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add girara_xdg_open_with_working_directory
parent
e263f458
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
girara/utils.c
girara/utils.c
+8
-2
girara/utils.h
girara/utils.h
+9
-0
No files found.
girara/utils.c
View file @
f0a64222
...
...
@@ -63,7 +63,7 @@ girara_fix_path(const char* path)
}
bool
girara_xdg_open
(
const
char
*
uri
)
girara_xdg_open
_with_working_directory
(
const
char
*
uri
,
const
char
*
working_directory
)
{
if
(
uri
==
NULL
||
strlen
(
uri
)
==
0
)
{
return
false
;
...
...
@@ -73,7 +73,7 @@ girara_xdg_open(const char* uri)
char
*
argv
[]
=
{
g_strdup
(
"xdg-open"
),
g_strdup
(
uri
),
NULL
};
GError
*
error
=
NULL
;
const
bool
res
=
g_spawn_async
(
NULL
,
argv
,
NULL
,
G_SPAWN_SEARCH_PATH
,
NULL
,
const
bool
res
=
g_spawn_async
(
working_directory
,
argv
,
NULL
,
G_SPAWN_SEARCH_PATH
,
NULL
,
NULL
,
NULL
,
&
error
);
if
(
error
!=
NULL
)
{
girara_warning
(
"Failed to execute command: %s"
,
error
->
message
);
...
...
@@ -86,6 +86,12 @@ girara_xdg_open(const char* uri)
return
res
;
}
bool
girara_xdg_open
(
const
char
*
uri
)
{
return
girara_xdg_open_with_working_directory
(
uri
,
NULL
);
}
char
*
girara_get_home_directory
(
const
char
*
user
)
{
...
...
girara/utils.h
View file @
f0a64222
...
...
@@ -47,6 +47,15 @@ char* girara_get_xdg_path(girara_xdg_path_t path) GIRARA_VISIBLE;
*/
bool
girara_xdg_open
(
const
char
*
uri
)
GIRARA_VISIBLE
;
/**
* Opens a URI with xdg-open in a different working directory.
*
* @param uri the URI to be opened.
* @param working_directory working directory
* @return true on success, false otherwise
*/
bool
girara_xdg_open_with_working_directory
(
const
char
*
uri
,
const
char
*
working_directory
)
GIRARA_VISIBLE
;
/**
* Splits paths separated by : (as in $PATH) into a list.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment