Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Path::self() #2282

Closed
aleks-f opened this issue Apr 11, 2018 · 3 comments · Fixed by #4319
Closed

Add Path::self() #2282

aleks-f opened this issue Apr 11, 2018 · 3 comments · Fixed by #4319

Comments

@aleks-f
Copy link
Member

aleks-f commented Apr 11, 2018

Add an easy way to obtain the executable path. win/linux/mac only for now.
https://stackoverflow.com/a/1024937/205386

@aleks-f aleks-f added this to the Release 2.0.0 milestone Apr 11, 2018
@aleks-f aleks-f self-assigned this Apr 11, 2018
aleks-f added a commit that referenced this issue Apr 11, 2018
- fix Logging and Util conflicts
- fix Logging and util leftover bugs
- XML speedup
- add FastMemoryPool for weak ref counting memory allocation speedup
- Nullable for types without default constructor #617 (add alignment, fix warnings)
- Global static objects (de)initialization #2261
- add AtomicFlag
- add SpinlockMutex
- Add Path::self() #2282
- SQLite mismatch open/close API calls #2275
@aleks-f aleks-f modified the milestones: Release 2.0.0, Release 1.11.0 Jan 28, 2020
@JackyWoo
Copy link
Contributor

@aleks-f pls assgin to me.

@aleks-f
Copy link
Member Author

aleks-f commented Nov 29, 2023

@matejk see if we can squeeze this into 1.13. (needs to be properly tested on all major platforms; if not, push to 1.14

@matejk
Copy link
Contributor

matejk commented Dec 4, 2023

Just as curiosity:

GNU provides simpler way to get program name if _GNU_SOURCE is defined through a constant C string:

       extern char *program_invocation_name;
       extern char *program_invocation_short_name;

https://man7.org/linux/man-pages/man3/program_invocation_name.3.html

Linux, macOS and BSD also feature getprogname: https://www.unix.com/man-page/netbsd/3/getprogname/

On Windows, there is also __argv[0].

matejk added a commit that referenced this issue Dec 5, 2023
* Merge remote-tracking branch 'jackywoo/add_self_to_path' into 2282-path-self
* fix(Foundation): minor code cleanup. #2282
* enh(Foundation): Windows unit test for Path::self and exception for non-implemented platform.
* fix(Foundation): Path::self() throws SystemException when the path can't be acquired. #2282

Co-developed-by: Jackie Woo <wuchienchao@qq.com>
Co-developed-by: Matej Kenda <matejken@gmail.com>
@matejk matejk added the fixed label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants