Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. File paths

File paths

Scheduled Pinned Locked Moved Windows API
question
2 Posts 2 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Waldermort
    wrote on last edited by
    #1

    Whats going on with the file paths? I have the following two paths which I will expand. "%USERPROFILE%\\Local Settings\\Temporary Internet Files\\" "%USERPROFILE%\\appdata\\local\\microsoft\\windows\\temporary internet files\\" The first for XP the second for Vista. But, they both expand correctly AND I am able to open files using both ( in vista ). Looking in the %USERPROFILE% directory, I see the 'Local Settings' is a shortcut, to what exactly explorer doesn't show nor am I able to open it with explorer. This is causing havoc with my code since I am unable to easily distinguish which OS is being used. I'm guessing the 'Local Settings' points to the same folder and is there for backwards compatibility. If thats the case, then why bother changing the directory structure at all!

    M 1 Reply Last reply
    0
    • W Waldermort

      Whats going on with the file paths? I have the following two paths which I will expand. "%USERPROFILE%\\Local Settings\\Temporary Internet Files\\" "%USERPROFILE%\\appdata\\local\\microsoft\\windows\\temporary internet files\\" The first for XP the second for Vista. But, they both expand correctly AND I am able to open files using both ( in vista ). Looking in the %USERPROFILE% directory, I see the 'Local Settings' is a shortcut, to what exactly explorer doesn't show nor am I able to open it with explorer. This is causing havoc with my code since I am unable to easily distinguish which OS is being used. I'm guessing the 'Local Settings' points to the same folder and is there for backwards compatibility. If thats the case, then why bother changing the directory structure at all!

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      You shouldn't be hard-coding any of those paths, use SHGetSpecialFolderPath() to get a path. And use GetVersionEx() to get the OS version. In Vista, MS shortened many pre-defined paths. Eg \Documents and Settings is now \Users. As for why this was done, I assume it was to avoid the MAX_PATH limit. With virtualization, some files can get put in paths that are pretty long and many levels deep.

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups