[RMMV] GETTING THE ABSOLUTE PATH OF INDEX.HTML ON DISK
Posts
Pages:
1
I'm trying to adapt Kino's file system utils code to fit a plugin I'm working on. I need to get the absolute path of where the game has the index.html on disk. All I get from window.location are relative paths, which won't work, since my adaptation reads/writes things relative to the root of the hard drive the game is on.
I don't have MV, but, my thoughts on this issue go to Tsukihime's Resource-Checker that I've used in Ace projects. It uses a constant to set the path to the RTP directory to be either compared to, or written from, and later defines sub-directories.
It occurs to me that you might be able to do something similar?
module Tsuki module Resource_Checker # Copy your RTP path here. # Don't forget the trailing slash (I don't check it) RTP_Directory = "F:/Program Files/RPG Runtime/RPGVXAce/" # Set it to false if you only want a list of resources you use Copy_Files_Over = false # change this if you need to Check_Key = Input::F5 #============================================================================== # ** Rest of the script #============================================================================== Graphics_Dirs = [:Animations, :Battlebacks1, :Battlebacks2, :Battlers, :Characters, :Faces, :Parallaxes, :Pictures, :System, :Tilesets, :Titles1, :Titles2] Audio_Dirs = [:BGM, :BGS, :ME, :SE] Font_Dirs = [:Fonts] # this is supposed to add some path checking... def self.rtp_directory RTP_Directory end def self.rpgvxace? defined? BasicObject end def self.rpgvx? defined? Graphics.resize_screen end def self.show_message(message) if rpgvxace? $game_message.add(message) elsif rpgvx? $game_message.texts.push(message) end end def self.init_resource_finder return Resource_Finder_Ace.new if rpgvxace? return Resource_Finder_VX.new if rpgvx? end end end
It occurs to me that you might be able to do something similar?
That's not quite what I was going for, but thanks. Also, I just figured out the problem: Kino purposely set his file system plugin to do things relative to the hard drive root. When you use Node's file system module raw, it does things relative to the index.html's location (provided MV is running it).
With that, I think I know how I'm supposed to refactor Kino's code so it serves my purposes ^_^ No more need to worry about absolute paths.
With that, I think I know how I'm supposed to refactor Kino's code so it serves my purposes ^_^ No more need to worry about absolute paths.
Pages:
1