You are here

Drive keeps changing name (G, K, L etc.) from PC to PC

10 posts / 0 new
Last post
flofies
Offline
Last seen: 11 years 6 months ago
Joined: 2009-04-09 00:33
Drive keeps changing name (G, K, L etc.) from PC to PC

Hello, I've been using PA for 2 years now but I recently started to experience a change in the name of the drive which, - specially for XAMMP - causes me trouble to start Apache since the drive it's inserted in is not being read correctly; for example, if I installed and used the G: drive and insert it on another PC on the Secret drive, the PA is read as G: (on screen and in the Win Explorer) any ideas ?

Thanks in advace

John T. Haller
John T. Haller's picture
Online
Last seen: 22 min 12 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Setup

In XAMPP, if you're using it portably, you have to be sure not to run the setup routine that registers and configures certain things according to their site. It sounds like you did run that file. I think the only way to fix it is to start over, but I could be wrong.

Sometimes, the impossible can become possible, if you're awesome!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
Sort of

It can be done with some slightly fiddly cheating with the install file.

In install\install.php, look around line 19 for a line like this (it's been like this since 1.5):

$partwampp = substr(realpath(__FILE__), 0, strrpos(dirname(realpath(__FILE__)), '\\'));

What this does is it gets the installation directory of XAMPP, e.g. "X:\xampp". Now, you can cheat here by chucking away the first two characters, and making it into something like "\xampp"! It's the technique I used when I was wanting my copy fixed.
Change the line to the one provided below (probably with an appropriate comment about what you did):

$partwampp = substr(realpath(__FILE__), 2, strrpos(dirname(realpath(__FILE__)), '\\'));

Then you can run setup_xampp.bat and it should update your paths. If you really want to, here, you could move it from X:\xampp to X:\PortableApps\XAMPPPortable\App\XAMPP...

(Disclaimer: this will stop FileZilla Server from working, as it requires absolute paths to run... but then, it also requires running as a service, so now it's just doubly out!)

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

flofies
Offline
Last seen: 11 years 6 months ago
Joined: 2009-04-09 00:33
Thanks

Chris, I'll try it your way and then m2's and then Haller's solutions and I'll let you know which one worked the best.

Thank you all !

m2
Offline
Last seen: 13 years 1 month ago
Joined: 2006-12-12 12:00
Use the following

Use the following batch:

::TODO: Set it to the install directory. Later it will automatically update
set lastposition=X:\XAMPP

:: Compares and see if is necesary to change
IF "%lastposition%"=="%CD%" GOTO START

:: make the rules
@echo "-s%lastposition%" "-r%CD%">rules.dat
::TODO: the line below requires gsar to be placed in the system. Use some location relative to your script dir, that is %~dp0.
set gsar="gsar"
%gsar% -s:: -r:::: -o rules.dat
set /p rules=<rules.dat
del rules.dat
 
set prefix=%gsar% %rules% -iol

:: begins the party
:: TODO: Use this to update all files containing full path
:: The line below updates this batch
%prefix% "%~dpnx0"

:START
:: TODO: Start XAMPP

It requires gsar to work.

2JTH: I think here's some forum bug, code block ended too quickly. BTW formatting text in Drupal is painful...

"Those people who think they know everything are a great annoyance to those of us who do." Asimov

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
No

Don't do it this way: even if it does work properly (which I doubt) it won't work efficiently. My solution is perfect.

BTW, use the <pre> tag to format code things.

This way you can get your code to display
properly.

:-)

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

m2
Offline
Last seen: 13 years 1 month ago
Joined: 2006-12-12 12:00
It's perfect...except

It's perfect...except that
-it doesn't work when current directory != XAMPP directory (educated guess). It can even launch some things by mistake, which is a security issue.
-FileZilla server doesn't work
-Possibly some other things don't work, it's either totally untested or tested very little (guess).

About pre: Hmm once I knew this, I guess I'll forget again. It would be definitely better to make code work properly...

"Those people who think they know everything are a great annoyance to those of us who do." Asimov

nottRobin
Offline
Last seen: 13 years 6 months ago
Joined: 2008-09-25 12:03
Maintaining drive letter

Just in case you do have adminstrator access to each machine you want to use your portable device on:

On any one system you can make a USB drive always assume the same drive letter using XP's built in Windows Device Manager. This will only work if you have sufficient permission and the external device has a USB serial (as per the standard).

If you want more control you can also play around with Uwe Seiber's USB Drive Letter Manager. Once again this works by installing it on a local system. However, it can be configured to read the drive letter from a file stored on the external device itself (look in the "Samples for the migration" table).

Unfortunately on every new system that your device encounters that isn't configured with USBDLM your device will continue to be assigned the next available drive letter.

Robin.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
B:

One solution which will work in the vast majority of cases (probably more than 99.999%) is to use the program SUBST to associate

A single line which you can put in a batch file (while I hate the way people use batch files for everything, it's simpler here to do it as a batch file) to do this is subst B: %cd:~0,3% (where the working directory is anywhere on the USB drive).

Of course though the idea here is to make this unnecessary wherever possible, and it's possible in the vast majority of cases. My fix up higher deals with making XAMPP work once more.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

flofies
Offline
Last seen: 11 years 6 months ago
Joined: 2009-04-09 00:33
Thanks, problem solved

Chris, m2, Haller but most of all nottRobin thanks for all your help, nottRobin's solution was by far the simplest and fastest solution. It wasn't even necessary to download the recommended software, although I had to refresh the Registry with CCleaner.

Thanks again.

Log in or register to post comments