2

i can't set the absolute windows path with the help of the methods Folder::cd() or Folder Constructor from cakephp api. There are no errors or messages after method call.

Example

//path= C:".DS."Users".DS."User.Name".DS."Desktop".DS."Qualitätssicherung".DS."Testmanagement"
$fol = new Folder($path); 
print_r($fol->errors()); // empty
echo $fol->path; // empty

Other path definitions i tried:

C:\Users\User.Name\Desktop\Qualitätssicherung\Testmanagement
C:\\Users\\User.Name\\Desktop\\Qualitätssicherung\\Testmanagement

Should i use something like escaping or a special function to generate a valid path string?

PS: I'm using the latest version of cakephp :)

Solution

Found here: Stackoverflow

Problem was the special char ä in the path var. This code handle it:

$string = iconv(mb_detect_encoding($string, "auto"), 'Windows-1252', $string);
Community
  • 1
  • 1
Sentencio
  • 230
  • 1
  • 13

2 Answers2

0

IIRC you need two back slashes after drive name in windows so: 'C:\\Users\User.Name\Desktop\Qualitätssicherung\Testmanagement'

ADmad
  • 8,102
  • 16
  • 18
0

Ok, problem was the special char ä I found a solution here which works for me:

Stackoverflow

$string = iconv(mb_detect_encoding($string, "auto"), 'Windows-1252', $string);
Community
  • 1
  • 1
Sentencio
  • 230
  • 1
  • 13