FSearch安装时桌面文件路径权限错误及适配Ubuntu18.04路径的源码修改咨询
Hey there, let's break down your issues step by step and figure out how to fix them:
1. 编译安装时的权限错误
First off, the PermissionError you're seeing is because you're trying to write to /usr/local/share/applications as a regular user—system directories like this require root privileges to modify. Even if the directory didn't exist, running the install command with sudo would create it automatically. But since your Ubuntu 18.04 system uses /usr/share/applications for desktop entries (as you noticed), installing to /usr/local/share might not make FSearch show up in your launcher anyway.
2. 修改安装路径适配Ubuntu 18.04
The best way to get FSearch to install desktop files to /usr/share/applications (the right spot for your system) is to adjust the Meson build configuration. You don't even need to edit source code directly—here's how:
Option 1: Set the install prefix when initializing Meson
Instead of just running meson builddir, initialize the build directory with the system-wide prefix:
meson builddir --prefix=/usr
This tells Meson to install all files under /usr instead of the default /usr/local. Then run the install command with sudo:
sudo ninja -C builddir install
This will drop the desktop file directly into /usr/share/applications, which your Ubuntu 18.04 desktop will recognize immediately.
Option 2: Edit the build configuration files (if you prefer modifying source)
If you want to tweak the source code's default behavior, look for the Meson configuration that handles desktop file installation:
- Navigate to the
datafolder in your FSearch source directory - Open
meson.build—you'll likely find a section that looks like this (or similar):install_data( 'io.github.cboxdoerfer.FSearch.desktop', install_dir: join_paths(get_option('datadir'), 'applications') ) get_option('datadir')defaults toshareunder the install prefix. To force it to/usr/share/applicationsregardless of prefix, you can change theinstall_dirline to:install_dir: '/usr/share/applications'
Then re-run meson builddir and sudo ninja -C builddir install as before.
3. About the PPA version issue
The PPA you tried (ppa:christian-boxdoerfer/fsearch-stable) probably packages FSearch for newer Ubuntu releases, which might have dependencies or system path differences that break compatibility with 18.04. Stick with compiling from source using the prefix adjustment above—it's more reliable for your older system.
备注:内容来源于stack exchange,提问作者WhereIsTheManual

