Recent

Author Topic: Get path to localhost  (Read 9335 times)

Kips

  • New Member
  • *
  • Posts: 27
Get path to localhost
« on: February 16, 2012, 01:39:06 pm »
Hi,


How can I make a function that returns the path to the folder where the content of LOCALHOST is placed?

Windows Explorer can do that.

When I type "localhost" in the adress bar, i am correctly getting redirected to C:\xampp\htdocs, so it should be possible to do that from my program.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Get path to localhost
« Reply #1 on: February 16, 2012, 03:25:18 pm »
The contents of LOCALHOST.... hmmm :)

I think you might mean your HOSTS file... a <insert search engine name> search will bring that up... something like \windows\system32\drivers\etc\hosts... but that won't help

(suspect you have a xampp web server running on your local host/loopback adapter (127.0.0.1); probably Windows explorer interprets localhost as an internet address, uses Internet Explorer to browse to 127.0.0.1 and xampp shows you a listing of the files in its web root (c:\xampp\htdocs, apparently)...

But I might be wrong...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

mmxngg

  • New Member
  • *
  • Posts: 29
Re: Get path to localhost
« Reply #2 on: February 16, 2012, 04:17:40 pm »
Localhost is an alias for 127.0.0.1 (host/loopback). You have a list of the files in its web root because webserver don't find a valid index. So...no...only webserver know the real path (or virtual in some case) but you can try to get it on enviroment variable (depending on webserver)
Now i'm on Win7/32bits with Lazarus 1.0.4 FPC 2.6.0

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Get path to localhost
« Reply #3 on: February 17, 2012, 07:01:33 pm »
This behavior smells like an internal explorer functionality to me...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

 

TinyPortal © 2005-2018