Ruby方法Dir.glob没有返回文件列表

时间:2022-09-01 22:47:28

I use Dir.glob to return a list of files as follows:

我使用Dir.glob返回文件列表,如下所示:

file_location = "/path/to/file/"

file_location =“/ path / to / file /”

@files = Dir.glob{"#(file_location)*")

@files = Dir.glob {“#(file_location)*”)

This works fine when I run my application in development mode using the WEBrick server. However when I run my application in production mode on the same server using apache and passenger it does not retrieve the files that are located in that directory. Does anyone know how I can resolve this issue?

当我使用WEBrick服务器在开发模式下运行我的应用程序时,这很好用。但是,当我使用apache和passenger在同一服务器上以生产模式运行我的应用程序时,它不会检索位于该目录中的文件。有谁知道如何解决这个问题?

1 个解决方案

#1


1  

You could try:

你可以尝试:

file_location = "/path/to/file/"

@files = Dir["#{file_location}*"]

#1


1  

You could try:

你可以尝试:

file_location = "/path/to/file/"

@files = Dir["#{file_location}*"]