Branch: Tag:

2019-06-13

2019-06-13 10:00:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Cpp: __DIR__ now represents cwd with ".".

Previously it would sometimes be represented with "",
which was a bad idea considering use like

string file_path = __DIR__ "/file";

4783:    ref_push_string(this->current_file);    /* FIXME: This isn't safe if the master hasn't been compiled yet. */    APPLY_MASTER("dirname", 1); +  if ((TYPEOF(Pike_sp[-1]) == PIKE_T_STRING) && +  !Pike_sp[-1].u.string->len) { +  /* Convert empty directory to ".". +  * +  * This is so that the user won't run into surprises +  * when eg concating __DIR__ with "/foo.txt". +  */ +  pop_stack(); +  push_text("."); +  }    f_sprintf(2);    }