Convert the path (self) to a program name.

Ensure the path (self) will be treated as-is by POSIX shells when it is

used as a program name. In order to do that, prepend ./ if needed.

assert "foo".to_program_name == "./foo"
assert "/foo".to_program_name == "/foo"
assert "".to_program_name == "./"

Property definitions

core :: file $ Text :: to_program_name
	# Convert the path (`self`) to a program name.
	#
	# Ensure the path (`self`) will be treated as-is by POSIX shells when it is
	# used as a program name. In order to do that, prepend `./` if needed.
	#
	#     assert "foo".to_program_name == "./foo"
	#     assert "/foo".to_program_name == "/foo"
	#     assert "".to_program_name == "./" # At least, your shell will detect the error.
	fun to_program_name: String do
		if self.has_prefix("/") then
			return self.to_s
		else
			return "./{self}"
		end
	end
lib/core/file.nit:1127,2--1141,4