Class: Applocale::FilePathUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/applocale/Util/file_util.rb

Constant Summary collapse

DIRNAME_MAIN =
'AppLocale'
DIRNAME_IOS =
'IOS'
DIRNAME_ANDROID =
'Android'
FILENAME_CONFIG =
'AppLocaleFile'
FILENAME_XLSX =
'string.xlsx'
GOOGLE_CREDENTIALS =
'google_credentials.yaml'
EXPORT_FORMAT =
'xlsx'

Class Method Summary collapse

Class Method Details

.default_config_filenameObject



27
28
29
# File 'lib/applocale/Util/file_util.rb', line 27

def self.default_config_filename
  return FILENAME_CONFIG
end

.default_export_formatObject



58
59
60
# File 'lib/applocale/Util/file_util.rb', line 58

def self.default_export_format
  EXPORT_FORMAT
end

.default_export_toObject



31
32
33
# File 'lib/applocale/Util/file_util.rb', line 31

def self.default_export_to
  return DIRNAME_MAIN + "/Resource"
end

.default_google_credentials_filenameObject



23
24
25
# File 'lib/applocale/Util/file_util.rb', line 23

def self.default_google_credentials_filename
  return GOOGLE_CREDENTIALS
end

.default_localefile_relative_pathstr(platform, lang) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/applocale/Util/file_util.rb', line 40

def self.default_localefile_relative_pathstr(platform, lang)
  if platform == Platform::IOS
    dirname = DIRNAME_IOS
  elsif platform == Platform::ANDROID
    dirname = DIRNAME_ANDROID
  end
  unless dirname.nil?
    filename = Locale.filename(platform, lang)
    return "#{dirname}/#{filename}"
  end
  return nil
end

.default_mainfolderObject



35
36
37
# File 'lib/applocale/Util/file_util.rb', line 35

def self.default_mainfolder
  return DIRNAME_MAIN
end

.default_xlsx_relativepath_strObject



53
54
55
56
# File 'lib/applocale/Util/file_util.rb', line 53

def self.default_xlsx_relativepath_str
  filename = FILENAME_XLSX
  return filename
end

.get_proj_absoluat_path(proj_path) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/applocale/Util/file_util.rb', line 15

def self.get_proj_absoluat_path(proj_path)
  path = proj_path
  if !(Pathname.new proj_path).absolute?
    path = File.expand_path(proj_path,Dir.pwd)
  end
  return path
end

.str_to_folderpathstr(str) ⇒ Object



62
63
64
65
66
67
# File 'lib/applocale/Util/file_util.rb', line 62

def self.str_to_folderpathstr(str)
  pathstr = Pathname.new(str.strip)
  if File.directory?(pathstr)
    pathstr = File.join(self.configfile_pathstr, FilePathUtil.default_config_filename).to_s
  end
end