#!/usr/bin/env ruby
# KageServer - access and fetch Kage glyph data files
-# $Id: kageserver.rb,v 1.2 2003-11-10 08:38:12 eto Exp $
+# $Id: kageserver.rb,v 1.3 2003-11-30 13:16:38 eto Exp $
# Copyright (C) 2002-2003 Kouichirou Eto, All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
# You can redistribute it and/or modify it under the terms of the GNU GPL2.
SKELETON = 0
MINCHO = 1
GOTHIC = 2
- HOME_DIR = "d:/work/chise/"
- CACHE_DIR = HOME_DIR + "cache_kage"
URL = "http://192.168.2.60:5100/"
def initialize(url=URL)
@url = url
@use_cache = true #デフォルト: cacheに存在する場合はcacheから引き出す。
@offline = false #テスト用
@offline = true #テスト用
- Dir.mkdir(CACHE_DIR) unless FileTest.directory?(CACHE_DIR)
+ c = Config.instance
+ @cache_dir = c.base_dir+"/cache_kage"
+ Dir.mkdir(@cache_dir) unless FileTest.directory?(@cache_dir)
end
attr_accessor :url, :use_cache, :offline
def filename(num, type=SKELETON) sprintf("u%04x.%s", num, TYPES[type]) end
- def cache_file(num, type=SKELETON) CACHE_DIR+"/"+filename(num, type)+".svg" end
+ def cache_file(num, type=SKELETON) @cache_dir+"/"+filename(num, type)+".svg" end
def list_cache
ar = []
- Dir.chdir(CACHE_DIR)
+ Dir.chdir(@cache_dir)
Dir.glob("*.svg").each {|file|
if file =~ /^u([0-9a-fA-F]+).skeleton.svg$/
code = $1.hex