 |
| View previous topic :: View next topic |
| Author |
Message |
syn
Joined: 12 May 2006 Posts: 46 Location: Hamburg
|
Posted: Mon Sep 04, 2006 6:50 pm Post subject: offtopic but php5 - How to get 8.3 Path from regular path |
|
|
Hi,
i know, this isnt a php-gtk2 question... but if you use php-gtk2 at windows, maybe you will have the same problem sometimes
have someone a hint how to get 8.3 (Dos/WIN)-Paths from a normal windows path?
I have this relapath:
C:\programme\testverzeichnis3\testprogramm.exe
I want this Dos 8.3 styles-path
C:\progra~1\testve~3\testpr~1.exe
Hope, someone can help me to get these path
Thank you. |
|
| Back to top |
|
 |
asnth
Joined: 31 Aug 2006 Posts: 7
|
Posted: Mon Sep 04, 2006 9:09 pm Post subject: |
|
|
Something like this but instead of "~1" you'll have to check for the existence of similar paths / files and increment to ~2 etc
$path = "C:\programme\testverzeichnis3\testprogramm.exe";
echo dos83 ($path);
function dos83 ($file) {
$file = str_replace ("\t", "/t", $file);
$file = str_replace ("\n", "/n", $file);
$file = str_replace ("\\", "/", $file);
$ext = substr ($file, strlen ($file) - 3);
$file = explode ("/", $file);
foreach ($file as $key => $value) {
if (strlen ($value) > 8) {
$file[$key] = substr ($value, 0, 6)."~1";
}
}
return implode ("/", $file).".".$ext;
} |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
 |