Marc Reichelt
10/20/2022, 11:44 AMbinary :
1. If the program is named binary , I’d like to get that in Kotlin code
2. If the program is renamed to othername and executed, I’d like to get othername
Is that possible in Kotlin Native?
PS: Basically this is available as argv[0] in C/C++, but doesn’t seem to be available in Java programs.Landry Norris
10/20/2022, 1:07 PMMarc Reichelt
10/20/2022, 1:08 PMMarc Reichelt
10/20/2022, 1:10 PMfun main(args: Array<String>) {
println(args.toList())
}
Compiled with kotlinc-native -o args args.kt :
$ ./args.kexe one two three
[one, two, three]Marc Reichelt
10/20/2022, 1:10 PM./args.kexe or args.kexeLandry Norris
10/20/2022, 1:11 PMMarc Reichelt
10/20/2022, 1:11 PMMarc Reichelt
10/20/2022, 1:11 PMribesg
10/20/2022, 1:13 PMMarc Reichelt
10/20/2022, 3:41 PMnapperley
10/20/2022, 7:48 PMnapperley
10/20/2022, 7:53 PMMarc Reichelt
10/21/2022, 8:17 AM