设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1802|回复: 2
打印 上一主题 下一主题

[已经解决] rgss如何查找一个在其他位置的文件

 关闭 [复制链接]

Lv3.寻梦者

梦石
0
星屑
1671
在线时间
2205 小时
注册时间
2010-6-27
帖子
1299
跳转到指定楼层
1
发表于 2011-3-8 20:20:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    require不能用……怨念

于是我也广告下…

Lv1.梦旅人

梦石
0
星屑
202
在线时间
498 小时
注册时间
2006-10-21
帖子
907
2
发表于 2011-3-9 00:34:07 | 只看该作者
不懂何意……自动搜索文件?有什么用?

只知道RM能判定文件是否存在 FileTest.exist?(文件路径)

点评

邪恶的作用。  发表于 2011-3-9 07:59
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
120
在线时间
953 小时
注册时间
2007-4-25
帖子
805
3
发表于 2011-3-9 02:41:05 | 只看该作者
Dir 类里有不少接口可以用来进行与目录相关的操作:
http://ruby-doc.org/core/classes/Dir.html
比如 Dir.foreach 就可以迭代某目录下每一个文件的名字(如果是文件夹,可以进行递归),进行搜索。

要是图省事,也可以通过 MS-DOS 的 find 命令间接查找:
FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.
[email protected]:~> repeat 1 fortune
Matz is nice, so we are nice.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-7-23 20:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表