Finalise pull from ikasty to show relative filenames in --watchfd
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
UNRELEASED
|
UNRELEASED
|
||||||
|
* The "`--watchfd`" option will now show relative filenames, if they are under the current directory (patch supplied by [ikasty](https://github.com/ikasty))
|
||||||
* support for Red Hat Enterprise Linux and its derivatives has been dropped; removed the RPM spec file, and will no longer build binaries
|
* support for Red Hat Enterprise Linux and its derivatives has been dropped; removed the RPM spec file, and will no longer build binaries
|
||||||
* docs: moved all open issues into GitHub and updated the TODO list
|
* docs: moved all open issues into GitHub and updated the TODO list
|
||||||
* docs: renamed README to README.md and altered it to Markdown format
|
* docs: renamed README to README.md and altered it to Markdown format
|
||||||
|
|||||||
+6
-3
@@ -37,13 +37,16 @@ pvstate_t pv_state_alloc(const char *program_name)
|
|||||||
#endif /* HAVE_SPLICE */
|
#endif /* HAVE_SPLICE */
|
||||||
state->display_visible = false;
|
state->display_visible = false;
|
||||||
|
|
||||||
//get cwd from system and set to state
|
/*
|
||||||
|
* Get the current working directory, if possible, as a base for
|
||||||
|
* showing relative filenames with --watchfd.
|
||||||
|
*/
|
||||||
if (NULL == getcwd(state->cwd, sizeof(state->cwd))) {
|
if (NULL == getcwd(state->cwd, sizeof(state->cwd))) {
|
||||||
// ignore error, using full path
|
/* failed - will always show full path */
|
||||||
state->cwd[0] = '\0';
|
state->cwd[0] = '\0';
|
||||||
}
|
}
|
||||||
if ('\0' == state->cwd[1]) {
|
if ('\0' == state->cwd[1]) {
|
||||||
// ignore when current working directory is root directory
|
/* CWD is root directory - always show full path */
|
||||||
state->cwd[0] = '\0';
|
state->cwd[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -363,6 +363,9 @@ int pv_watchpid_scanfds(pvstate_t state, pvstate_t pristine,
|
|||||||
/*
|
/*
|
||||||
* Set the display name for the given watched file descriptor, truncating at
|
* Set the display name for the given watched file descriptor, truncating at
|
||||||
* the relevant places according to the current screen width.
|
* the relevant places according to the current screen width.
|
||||||
|
*
|
||||||
|
* If the file descriptor is pointing to a file under the current working
|
||||||
|
* directory, show its relative path, not the full path.
|
||||||
*/
|
*/
|
||||||
void pv_watchpid_setname(pvstate_t state, pvwatchfd_t info)
|
void pv_watchpid_setname(pvstate_t state, pvwatchfd_t info)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user