gnope php gtk gui gnope.org  

offtopic but php5 - How to get 8.3 Path from regular path

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
syn



Joined: 12 May 2006
Posts: 46
Location: Hamburg

PostPosted: Mon Sep 04, 2006 6:50 pm    Post subject: offtopic but php5 - How to get 8.3 Path from regular path Reply with quote

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 Smile

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 Smile

Thank you.
Back to top
asnth



Joined: 31 Aug 2006
Posts: 7

PostPosted: Mon Sep 04, 2006 9:09 pm    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.