Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create recording file under certain circumstances #39

Open
hujiejeff opened this issue Oct 17, 2018 · 0 comments
Open

Failed to create recording file under certain circumstances #39

hujiejeff opened this issue Oct 17, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@hujiejeff
Copy link

If you create a recording file with the same name as a folder in that directory, you will be unable to create the recording file
f.exists() && !f.isDirectory() has problem in RecordingService.java

public void setFileNameAndPath(boolean isFilePathTemp) {
        if (isFilePathTemp) {
            mFileName = getString(R.string.default_file_name) + (++tempFileCount) + "_" + ".tmp";
            mFilePath = Paths.combine(
                    Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC),
                    Paths.SOUND_RECORDER_FOLDER, mFileName);
        } else {
            int count = 0;
            File f;

            do {
                ++count;

                mFileName =
                        getString(R.string.default_file_name) + "_" + (mDatabase.getCount() + count) + ".mp4";

                mFilePath = Paths.combine(
                        Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC),
                        Paths.SOUND_RECORDER_FOLDER, mFileName);

                f = new File(mFilePath);
            } while (f.exists() && !f.isDirectory());//Bug in here
        }
    }
@naXa777 naXa777 added the bug Something isn't working label Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants