Changeset 3214

Show
Ignore:
Timestamp:
01/16/10 00:17:14 (8 weeks ago)
Author:
ghoulsblade
Message:
use .iris for config and temp data in user home dir if USE_HOME_DIR exists in iris maindir, centralized a few path variables
Location:
trunk
Files:
1 added
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/lua/lib.compass.lua

    r2960 r3214  
    362362    if (not md5) then print("WARNING, md5 checks for tmp/compass* files not possible (maps)") md5 = "md5dummy" end  
    363363 
    364     gMapImagePath_Small = datapath.."tmp/compass_"..md5.."_small_s.png" 
     364    gMapImagePath_Small = gTempPath.."compass_"..md5.."_small_s.png" 
    365365 
    366366    local mapfile_exists = file_exists(gMapImagePath_Small) 
  • trunk/lua/lib.desktop.lua

    r2993 r3214  
    44]]-- 
    55 
    6 gDesktopDir = gMainWorkingDir.."data/desktop/" 
    76gDesktop = {} 
    87gDesktopPositions = {} 
  • trunk/lua/lib.macrolist.lua

    r3207 r3214  
    469469function MacroCmd_ActivateNextRenderer  ()              if (gInGameStarted) then ActivateNextRenderer() end end 
    470470function MacroCmd_CamChangeZoom         (zoomadd)       if (gInGameStarted) then gCurrentRenderer:CamChangeZoom(zoomadd) end end 
    471 function MacroCmd_Screenshot            ()              Client_TakeScreenshot(gMainWorkingDir.."screenshots/") end 
     471function MacroCmd_Screenshot            ()              Client_TakeScreenshot(gScreenshotDir) end 
    472472function MacroCmd_GridScreenshot        ()           
    473473    if (not gInGameStarted) then return end 
    474474    ToggleCompass() 
    475     Client_TakeGridScreenshot(gMainWorkingDir.."screenshots/") 
     475    Client_TakeGridScreenshot(gScreenshotDir) 
    476476    ToggleCompass() 
    477477end 
  • trunk/lua/lib.registry.slow.lua

    r2910 r3214  
    77function gRegistrySlow:Set (key,val) self.data[key] = val   self:Save() end 
    88function gRegistrySlow:Get (key) return self.data[key] end 
    9 function gRegistrySlow:GetFilePath () return gMainWorkingDir.."config/registry.xml" end 
     9function gRegistrySlow:GetFilePath () return gConfigPath.."registry.xml" end 
    1010function gRegistrySlow:Load () self.data =      SimpleXMLLoad(self:GetFilePath()) or {} end 
    1111function gRegistrySlow:Save ()                          SimpleXMLSave(self:GetFilePath(),self.data) end 
  • trunk/lua/lib.shardlist.lua

    r2963 r3214  
    22-- paths 
    33 
    4 function GetConfigDirPath               () return gMainWorkingDir.."config/" end 
     4function GetConfigDirPath               () return gConfigPath end 
    55function GetShardListDirPath            () return GetConfigDirPath().."shards/" end 
    66function GetShardMemoryFilePath         () return GetConfigDirPath().."shardmemory.xml" end 
  • trunk/lua/main.lua

    r3190 r3214  
    22--###        CONSTANTS        ### 
    33--############################### 
     4 
    45 
    56gMainWorkingDir     = GetMainWorkingDir and GetMainWorkingDir() or "" 
     
    1011gMainPluginDir      = gMainWorkingDir.."plugins/" 
    1112gConfigPath         = gMainWorkingDir.."config/" 
     13gDesktopDir                     = gMainWorkingDir.."data/desktop/" 
     14gScreenshotDir          = gMainWorkingDir.."screenshots/" 
    1215gMacroFile          = "mymacros.lua" 
    1316gMacroPathFile      = gConfigPath..gMacroFile 
     
    2629 
    2730--############################### 
     31--###    USE USER HOME DIR    ### 
     32--############################### 
     33 
     34function InitHomeDirInfos () 
     35        -- todo : shardlist : display shards from original dir also ? 
     36        if ((not WIN32) and file_exists(gMainWorkingDir.."USE_HOME_DIR")) then 
     37                local home = GetHomePath() 
     38                if (not home) then return end 
     39                 
     40                gHomeIrisPath           = home.."/.iris/" 
     41                gTempPath                       = gHomeIrisPath.."tmp/" 
     42                gScreenshotDir          = gHomeIrisPath.."screenshots/" 
     43                gConfigPath             = gHomeIrisPath.."config/" 
     44                gConfigPathFile     = gConfigPath..gConfigFile 
     45                gMacroPathFile      = gConfigPath..gMacroFile 
     46                 
     47                if (not file_exists(gHomeIrisPath)) then 
     48                        print("initializing "..gHomeIrisPath) 
     49                        mkdir(gHomeIrisPath) 
     50                        mkdir(gTempPath) 
     51                        mkdir(gScreenshotDir) 
     52                        mkdir(gConfigPath) 
     53                        MyCopyDir(gMainWorkingDir.."config/",gConfigPath) 
     54                end 
     55        end 
     56end 
     57 
     58--############################### 
    2859--###     OTHER LUA FILES     ### 
    2960--############################### 
     
    3768dofile(libpath .. "lib.keybinds.lua") 
    3869dofile(libpath .. "lib.net.lua") 
     70 
     71InitHomeDirInfos() 
    3972 
    4073-- renderer second 
     
    235268    OgreAddResLoc(mydatapath.."."                           ,"FileSystem","General") 
    236269    OgreAddResLoc(mydatapath.."base"                        ,"FileSystem","General") 
    237     OgreAddResLoc(mydatapath.."tmp"                         ,"FileSystem","General") 
     270    OgreAddResLoc(string.gsub(gTempPath,"/$","")                        ,"FileSystem","General") -- remove trailing slash ? 
    238271    OgreAddResLoc(mydatapath.."base/ui"                     ,"FileSystem","General") 
    239272    OgreAddResLoc(mydatapath.."base/font"                   ,"FileSystem","General") 
  • trunk/lua/widgets/widget.mappiece.lua

    r2790 r3214  
    2323         
    2424        k = k..".png" 
    25         local b = datapath.."tmp/" 
     25        local b = gTempPath 
    2626         
    2727        if file_exists(b..k) then