If the user is in a directory which has been unlinked, it is possible
for the path .. to not exist, relative to the working directory.
Always pass in the working directory (potentially virtual) to
path_get_cdpath; this ensures we check absolute paths and are immune
from issues if the working directory has been unlinked.
Also introduce a new function path_normalize_for_cd which normalizes the
"join point" of a path and a working directory. This allows us to 'cd' out of
a non-existent directory, but not cd into such a directory.
Fixes#5341
This is the first step to implementing issue #4200 is to stop subclassing
env_var_t from wcstring. Not too surprisingly doing this identified
several places that were incorrectly treating env_var_t and wcstring as
interchangeable types. I'm not talking about those places that passed
an env_var_t instance to a function that takes a wcstring. I'm talking
about doing things like assigning the former to the latter type, relying
on the implicit conversion, and thus losing information.
We also rename `env_get_string()` to `env_get()` for symmetry with
`env_set()` and to make it clear the function does not return a string.
Remove the "make iwyu" build target. Move the functionality into the
recently introduced lint.fish script. Fix a lot, but not all, of the
include-what-you-use errors. Specifically, it fixes all of the IWYU errors
on my OS X server but only removes some of them on my Ubuntu 14.04 server.
Fixes#2957
Add new functions path_get_data and path_create_data which parallel existing
functions path_get_config and path_create_data. The new functions refer to
XDG_DATA_HOME, if it is defined, or ./local/share if not.
Modify history_filename to use the new function path_get_data.
As a consequence, fish_history will now be located in XDG_DATA_HOME,
not XDG_CONFIG_HOME.
Note that these changes mirror what is already used in
fish-shell/share/tools/create_manpage_completions.py, which stores the
completions in XDG_DATA_HOME
This change matches recommendations in the xdg basedir spec at
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
($XDG_DATA_HOME defines the base directory relative to which user specific data
files should be stored. If $XDG_DATA_HOME is either not set or empty, a default
equal to $HOME/.local/share should be used.)
It addresses suggestions from the following issues:
1. Don't put history in $XDG_CONFIG_HOME (closes#744)
https://github.com/fish-shell/fish-shell/issues/744
2. Fish is placing non-config files in $XDG_CONFIG_HOME #1257https://github.com/fish-shell/fish-shell/issues/1257
3. Move non-config data out of $XDG_CONFIG_HOME #1669https://github.com/fish-shell/fish-shell/issues/1669
This change moves source files into a src/ directory,
and puts object files into an obj/ directory. The Makefile
and xcode project are updated accordingly.
Fixes#1866